[英]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.