小编Mic*_*ael的帖子

引用 System.Management for Powershell on C# .NET 4.0 不起作用

我有一个 .NET 4.0 C# 项目,我需要在 powershell 运行空间中通过 C# 运行 Powershell。我已经测试了我的代码,一切正常。

在新计算机(Win10、VS2017)上打开同一个项目并尝试运行同一个项目时出现问题。我已经在以下位置引用了 DLL:

C:\windows\Microsoft.Net\assembly\GAC_MSIL\System.Management.Automation\v4.0_3.0.0.0__31bf3856ad364e35\System.Management.Automation.dll

也使用命令执行此操作

using System.Management;
using System.Management.Automation;
using System.Management.Automation.Runspaces;
Run Code Online (Sandbox Code Playgroud)

但无法识别 System.Management.Automation 和 System.Management.Automation.Runspaces。

出现错误:命名空间“System.Management”中不存在类型或命名空间名称“Automation”(您是否缺少程序集引用?)

不知何故,引用没有被使用......

c# powershell

5
推荐指数
1
解决办法
6726
查看次数

标签 统计

c# ×1

powershell ×1