Powershell: No support of System.Management.Automation for .net framework

Created on 24 May 2020  路  4Comments  路  Source: PowerShell/PowerShell

In my project, we are using .net framework 4.6,2 and want to call powershell from our c# code. When i went to nuget to install the required library (System.Management.Automation), i could see that 6.x.x onward versions are available and all support .net core and not .net framework.

my ask is how should i use or call powershell in my application as i cant upgrade it to .net core. It is a legacy application. I could manage to find one "Install-Package System.Management.Automation.dll -Version 10.0.10586" whicb alteast let me use PS but that is a deprecated one.

Please suggest how can i get old versions of above library from nuget for .net framework as that is blocking my work currently as we are short of time now.

Issue-Question Resolution-Answered

Most helpful comment

You should be able to use https://www.nuget.org/packages/PowerShellStandard.Library

Version 5.1 works with Windows Powershell.

Contains the reference assemblies for PowerShell Standard 5

All 4 comments

You should be able to use https://www.nuget.org/packages/PowerShellStandard.Library

Version 5.1 works with Windows Powershell.

Contains the reference assemblies for PowerShell Standard 5

@powercode Is PowerShellStandard.Library 5.1.0 meant to supercede Microsoft.PowerShell.5.ReferenceAssemblies? Or do those have different purposes?

The standard library should work for .net core pwsh also.

This issue has been marked as answered and has not had any activity for 1 day. It has been closed for housekeeping purposes.

Was this page helpful?
0 / 5 - 0 ratings