How can I run PowerShell with the .NET 4 runtime?

前端 未结 11 2193
走了就别回头了
走了就别回头了 2020-11-22 07:38

I am updating a PowerShell script that manages some .NET assemblies. The script was written for assemblies built against .NET 2 (the same version of the framework that Power

11条回答
  •  臣服心动
    2020-11-22 08:05

    Just run powershell.exe with COMPLUS_version environment variable set to v4.0.30319. For example, from cmd.exe or .bat-file:

    set COMPLUS_version=v4.0.30319
    powershell -file c:\scripts\test.ps1
    

提交回复
热议问题