如何在未安装 PowerShell 的计算机上部署 Powershell 2.0 自定义主机应用程序?

发布于 2024-12-08 10:57:12 字数 177 浏览 1 评论 0原文

我开发了一个 Powershell 自定义主机应用程序,并希望将其部署在未安装 powershell 的计算机上。我在要部署的包中添加了“System.Management.Automation.dll”,并在我的 C# 项目中引用了它。然而,它似乎不起作用。至少,当我尝试在该计算机上构建应用程序时,它无法找到自动化程序集。有什么建议吗?

I've developed a Powershell custom host application and want to deploy it on a machine with no powershell installed. I added "System.Management.Automation.dll" in the package to deploy and have a reference to it in my C# project. However, it seems not working. At least, when I tried to build the application on that machine, it failed to locate the Automation assembly. Any suggestions?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

眼眸印温柔 2024-12-15 10:57:12

当你构建MSBuild或VS需要查找程序集时,它们对在哪里搜索有规则:检查项目文件中的提示路径(或VS中引用的属性)。

不过,我预计您仍然会遇到问题,PowerShell 是作为系统组件安装的,并且可能对安装程序包含的更新有更深层次的依赖。在目标系统和开发系统上安装 PowerShell 会好得多,任何其他途径都只会导致问题。

When you are building MSBuild or VS needs to find the assembly, they have rules about where to search: check the hint path in the project file (or the properties of the reference in VS).

However I expect you'll still have problems, PowerShell is installed as a system component and is likely to have much deeper dependencies on updates the installer includes. Far better to install PowerShell on both target and development systems, any other route is just going to lead to issues.

烟若柳尘 2024-12-15 10:57:12

无论从技术上还是法律上来说,PowerShell 引擎都不能作为程序集重新分发。卡尔·普罗瑟(Karl Prosser)几年前就开始研究这个问题,从那以后似乎没有任何改变。

http://karlprosser.com/coder/2008/06/17/portable-powershell-v1-and-v2-side-by-side-even-on-server-core/

The PowerShell engine is not restributable as an assembly, neither technically or legally. Karl Prosser goes into this a few years ago, and nothing appears to have changed since.

http://karlprosser.com/coder/2008/06/17/portable-powershell-v1-and-v2-side-by-side-even-on-server-core/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文