C
C#2y ago
Decabytes

❔ Trouble Creating PowerShell Commandlet

I'm using visual studio 2022, dotnet 6.0. I installed the automation package using
NuGet\Install-Package Microsoft.PowerShell.SDK -Version 7.2.9
But when I try to import the module after building the package I get the error in the screenshot. Does anyone have any ideas?
3 Replies
jcotton42
jcotton422y ago
@Decabytes what version of PowerShell is that? per $PSVersionTable I have a feeling you're using Windows PowerShell (5.1) and not PowerShell 7
Decabytes
Decabytes2y ago
You're right. I was using Powershell 5.1. To fix this I had to
winget install -e --id Microsoft.PowerShell -v 7.2.9.0
winget install -e --id Microsoft.PowerShell -v 7.2.9.0
Then I had to go click the gear in the powershell window of visual studio and add the path to the 7.2.9 version of powershell. Then it worked!
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server
More Posts
✅ Passing data from controller to viewHi guys hoping for some help here. I have an eCommerce wep app using ASP.NET MVC (7.0) and I want tHow to implement that when you click on the button the data that was sent with it will be displayedHow to implement that when you click on the button the data that was sent with it will be displayed❔ Visual Studio: How to hide tptrace output from Immediate Window during Test Explorer executions?Title says it all. Is there a way to hide the output messages from tptrace that get written to the I❔ Name "PostsService" does not exist in the current context```cs @using BlazorBookGroup.Data . . . private PostsService postsService = new(); protecte❔ System.AccessViolationException: 'Attempted to read or write protected memory.Even with <AllowUnsafeCodeBlocks> enabled and using unsafe { }, this error does not go away. And bef❔ namespace 'Models' does not exist in the namespace 'BlazorBookGroup'It is a subfolder though so what's the issue?❔ .Net Core API User.FindFirstValue(ClaimTypes.NameIdentifier) in every action?!Hi everyone I have the end point below ``` [HttpPost, Route("stores/new"), Authorize(policy: "client❔ Is it possible to change a project sdk from Microsoft.NET.Sdk to Microft.net.sdk.net?I'm completely new to c# and .NET so apologies if this doesn't make sense. If a project csproj file❔ Razor pages redirectHow do you make a form redirect to a page, and pass a value to it? My entire application is routed❔ FileNotFoundException for NuGet Pkg in Az Function AppHi, I'm receiving the following error while trying to locally test an Azure Function App: ```System