❔ 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.9But 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
@Decabytes what version of PowerShell is that?
per
$PSVersionTable
I have a feeling you're using Windows PowerShell (5.1) and not PowerShell 7You're right. I was using Powershell 5.1. To fix this I had to
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!
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.