【问题标题】:Application using PowerShell System.Management.Automation compiled on Windows 8 not working on Windows 7使用在 Windows 8 上编译的 PowerShell System.Management.Automation 的应用程序无法在 Windows 7 上运行
【发布时间】:2013-05-21 11:52:55
【问题描述】:

我使用 VS2012 和 Framework 4.0 在 windows 8 上构建了一个 powershell 脚本运行程序,当我在 windows 7 上启动运行程序时,它给了我一个错误,因为 powershell 版本比 windows 8 上的旧。(Win7:PS2,Win8 PS3)。 (系统.管理.自动化)

除了在windows 7 上重新编译应用程序或在windows 7 上安装powershell 3 之外,还有什么解决方案吗? (或者升级我的 windows 7 机器:P)谢谢!

【问题讨论】:

  • 您在win7机器上安装了Windows Management Framework 3.0 (PowerShell 3.0)吗?请参阅microsoft.com/en-us/download/details.aspx?id=34595 下载
  • 哦,没看到最后一部分。也许可以简单地复制所需的dll并手动注册它,但我不推荐它。最佳和推荐选项:安装 WMF3.0。无论如何,它为您提供了一些改进的管理功能。

标签: powershell windows-7


【解决方案1】:

您可以在 Windows 8 上的项目中引用 PowerShell 2.0 版本的程序集 (v1)。使用该版本进行编译将使其在 Windows 7 (PowerShell 2.0) 和 Windows 8 (PowerShell 3.0) 上运行。

要获取此程序集的 PowerShell v2.0 版本,您可以从 GAC 中提取它或安装 PowerShell 2.0 SDK 并使用它。

还要确保您的项目以 .Net 3.5 为目标,使其无需安装 .Net 4.5 即可在 Windows 7 上运行。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-10-19
    • 1970-01-01
    • 2014-04-20
    • 2011-06-30
    • 2013-03-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多