【发布时间】:2017-02-15 17:15:54
【问题描述】:
我正在尝试使用二进制 Cmdlet 内部创建一个基本的 PowerShell 模块,因为仅在 PowerShell 中编写内容看起来不像在 C# 中那样方便。
按照this 指南,看来我必须:
- 将Microsoft.PowerShell.SDK 添加到我的
project.json - 用必需的属性标记我的 cmdlet 类
- 写清单文件,用
RootModule,针对我的.dll - 将
.dll放在附近的清单中 - 将两者都放在
PSModulePath下
但是,当我尝试 Import-Module 时,PowerShell 核心抱怨缺少运行时:
Import-Module : Could not load file or assembly 'System.Runtime, Version=4.1.0.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system
cannot find the file specified.
At line:1 char:1
是我做错了什么,还是还不支持这些棘手的事情?
【问题讨论】:
-
你能分享你的project.json吗?
-
抱歉,暂时不实际
标签: c# powershell .net-core cmdlets