You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Referencing System.Management.Automation in .NET Core / VS Code #2284
Works when you run dotnet restore in that it finds and claims to install the System.Management.Automation dependency (noting that .17515 isn't compatible with .NET Core). But you can't simply add a using in the code, or it says:
The type or namespace name 'Management' does not exist in the namespace 'System'
The intent here is to programmatically instantiate PowerShell in the code, but .NET Core is a bit restrictive in how it wants references handled...
This is a known issue for NuGet that we are trying to resolve. There are a number of rogue System.Management.Automation packages that external people have posted. Those packages are all "FullCLR" assemblies and are not compatible with PowerShell Core.
The current way to consume the PowerShell Core version of System.Management.Automation is to copy the technique used by this project. Our nuget.config file points to the correct version that is posted to MyGet. powershell-win-core\project.json shows how to consume it within your project.json.
You current setup consumes this package from nuget. You can make it consume your local SMA copy from GAC, if you build for FullCLR, but you would need to include reference under frameworks / net451 / frameworkAssemblies, like here
Activity
mirichmo commentedon Sep 16, 2016
This is a known issue for NuGet that we are trying to resolve. There are a number of rogue System.Management.Automation packages that external people have posted. Those packages are all "FullCLR" assemblies and are not compatible with PowerShell Core.
The current way to consume the PowerShell Core version of System.Management.Automation is to copy the technique used by this project. Our nuget.config file points to the correct version that is posted to MyGet. powershell-win-core\project.json shows how to consume it within your project.json.
vors commentedon Sep 16, 2016
Hi Don.
There are few things about
dotnetcli that may help you sort it out.nuget.configit will use https://www.nuget.orgPowerShell Team didn't published SMA there, but somebody did a long time ago (as Mike Richmond (@mirichmo) said) https://www.nuget.org/packages?q=System.Management.Automation
frameworks / net451 / frameworkAssemblies, like herePowerShell/src/System.Management.Automation/project.json
Line 188 in dd2394b
dependenciessections inproject.json: globabl and framework specific. You should use them appropriately.concentrateddon commentedon Sep 16, 2016
Perfect.