简体   繁体   English

将PowerShell包添加到.netstandard2.0类库中

[英]Add PowerShell package to .netstandard2.0 class library

I'm trying to migrate a C# class library that I previously built which was targeting .NET Framework v4.5 to .NET Standard 2.0. 我正在尝试将我之前构建的C#类库迁移到.NET Standard 2.0,该库将.NET Framework v4.5作为目标。

I tried many packages to include PowerShell support in my library but every time I include a package I get a warning saying that the package was included using a target framework different from the .NET Standard 2.0. 我尝试了很多软件包在我的库中包含PowerShell支持,但每次我都包含一个软件包时,我会收到一条警告,说明该软件包是使用不同于.NET Standard 2.0的目标框架包含的。

For example, with the System.Management.Automation_PowerShell_3.0` package I get the following error message 例如,使用System.Management.Automation_PowerShell_3.0`包,我收到以下错误消息

Le package 'System.Management.Automation_PowerShell_3.0 6.3.9600.17400' a été restauré en utilisant '.NETFramework,Version=v4.6.1' au lieu du framework cible du projet '.NETStandard,Version=v2.0'. Le package'System.Management.Automation_PowerShell_3.06.3.9600.17400'aétérestauréenutilisant'.NETFramework,Version = v4.6.1'au lieu du framework cible du projet'.NETStandard,Version = v2.0'。 Ce package n'est peut-être pas totalement compatible avec votre projet. Ce package n'est peut-êtrepastotalement兼容avec votre projet。

which would be roughly translated to English as 这将大致翻译成英文

The package 'System.Management.Automation_PowerShell_3.0 6.3.9600.17400' was restored using '.NETFramework,Version=v4.6.1' instead of the projet's target framework '.NETStandard,Version=v2.0'. 使用'.NETFramework,Version = v4.6.1'而不是projet的目标框架'.NETStandard,Version = v2.0'恢复了'System.Management.Automation_PowerShell_3.0 6.3.9600.17400'软件包。 This package may not be completely compatible with the target project. 此程序包可能与目标项目不完全兼容。

Since the main reason, I'm trying to port my library to .NET Standard is to support both the .NET Framework and the .NET Core targets, having a package one of the packages be .NET Framework-specific defeats the purpose of the port. 由于主要原因,我试图将我的库移植到.NET Standard是支持.NET Framework和.NET Core目标,有一个软件包,其中一个软件包是特定于.NET Framework的,目的是港口。

Do I have any workaround? 我有任何解决方法吗? Is there a PowerShell package that targets .NET Standard 2.0 that I missed (I tried about 10 PowerShell-related packaged in the VS17 NuGet explorer before posting here)? 是否存在我错过的针对.NET Standard 2.0的PowerShell包(我在VS17 NuGet资源管理器中尝试了大约10个与PowerShell相关的包,然后发布到此处)?

For some background, I use PowerShell to run node.exe from my C# library. 对于某些背景,我使用PowerShell从我的C#库运行node.exe。

As far as I know there isn't any way around this. 据我所知,没有办法解决这个问题。 The reason for that is the package is built using the .NETFramework so until the creators port their package to the .NETStandard , it will only be usable from .NETFramework apps since, in theory, that package could use libraries that are not in the .NETStandard . 原因是软件包是使用.NETFramework所以在创建者将其软件包移植到.NETStandard ,它只能从.NETFramework应用程序中使用,因为从理论上讲,该软件包可以使用不在其中的库.NETStandard

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在不同的 netstandard2.0 库 NU1202 中安装 netstandard2.0 Nuget 包 - Installing a netstandard2.0 Nuget Package inside a different netstandard2.0 library NU1202 在.netStandard2.0项目中添加“连接服务” - Add “Connected service” in .netStandard2.0 project 使用来自 NetStandard2.0 库的 HttpContext 请求/响应/会话 - Using HttpContext Request/Response/Session from NetStandard2.0 library 在不访问 ServicesCollection 的情况下使用 HttpClientFactory in.netstandard2.0 库 - Use HttpClientFactory in netstandard2.0 library without access to ServicesCollection ISystemClock 在 netstandard2.0 中不可用 - ISystemClock not available in netstandard2.0 .NetStandard2.0中的AsymmetricSecurityBindingElement在哪里? - Where is AsymmetricSecurityBindingElement in .NetStandard2.0? nuget 包中 .netstandard2.0 和 .netframework47 DLL 的混合 - .netstandard 不可用 - Mix of .netstandard2.0 and .netframework47 DLLs in nuget package - .netstandard not available netcoreapp2.0 和 netstandard2.0 - netcoreapp2.0 with netstandard2.0 无法将.Net Core 2.0项目的项目引用添加到Azure函数项目(netStandard2.0) - Not able to add project reference of .Net Core 2.0 project to Azure functions project(netStandard2.0) 如何在 .NetStandard2.0 项目中定位 Windows? - How to target Windows in .NetStandard2.0 project?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM