0

So, i have a project i was developing in Vs2012 on a Windows 8.1 host. This project is one that creates compiled cmdlets and so has a reference to System.Management.Automation. The .NET project is targeting Framework 4.0.

I upgraded my dev host to Windows10. Windows 10 has PS5.0, which targets .NET 4.5.

How would i create a compiled cmdlet (aka module) that targets .NET 4.0? Every time i add a reference to System.Management.Automation, i get the windows assembly that targets .NET 4.5.

However, since 4.5 is a drop-in replacement for 4.0, and as i understand an app targeting 4.0 can run properly when 4.5 is installed, i want to make my compiled cmdlet targeting 4.0. This will allow me to distribute this module to both Win8 and Win10 hosts.

I hope i explained this issue correctly.

iQueue
  • 191
  • 1
  • 6
  • Related (or at least gives you some tracks to follow): http://stackoverflow.com/questions/12060460/using-powershell-2-as-the-default-version-on-windows-8 – David Brabant Oct 19 '16 at 09:51
  • You need to use [PowerShell v3 reference assemblies](https://www.nuget.org/packages/Microsoft.PowerShell.3.ReferenceAssemblies), but not `System.Management.Automation` from GAC. – user4003407 Oct 19 '16 at 14:35

0 Answers0