我正在为PowerShellCore开发一个二进制模块。我已经将该模块发布到了PowershellGallery。当我尝试测试模块时,出现以下错误:
Import-Module : Could not load file or assembly 'System.Management.Automation, Version=6.1.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.
At /Users/janbaarssen/Projects/MFA/DevOps/PowerShell/AcmeCoreModule/src/Test-Application.ps1:5 char:1
+ Import-Module -Name AcmeCoreModule
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Import-Module], FileNotFoundException
+ FullyQualifiedErrorId : System.IO.FileNotFoundException,Microsoft.PowerShell.Commands.ImportModuleCommand
很遗憾,我无法找到关于此主题的任何东西。我引用了正确的NuGet程序包,但仍无法正常工作。
这是我的NuGet软件包:
<ItemGroup Condition="'$(TargetFramework)' != 'net472'">
<PackageReference Include="Certes" Version="2.3.2" />
<PackageReference Include="Microsoft.Azure.Management.AppService.Fluent" Version="1.17.0" />
<PackageReference Include="Microsoft.Azure.Management.Dns" Version="3.0.0" />
<PackageReference Include="Microsoft.Azure.Management.Dns.Fluent" Version="1.17.0" />
<PackageReference Include="Microsoft.PowerShell.SDK" Version="6.1.1" />
<PackageReference Include="NewtonSoft.JSON" Version="11.0.2" />
<PackageReference Include="NLog" Version="4.5.10" />
<PackageReference Include="System.Management.Automation" Version="6.1.1" />
</ItemGroup>
我该怎么做才能使这项工作生效。到目前为止,我找不到关于此主题的任何内容。该模块必须能够在MacOS和Windows上运行。