简体   繁体   English

有什么方法可以使用 .netstandard2.0 或 .netstandard3.0 将 .NETFramework 4.7.1 nuget 安装到项目中

[英]Is there any way we can install .NETFramework 4.7.1 nuget into project using .netstandard2.0 or .netstandard3.0

I am trying to install nuget which was built using .NET Framework 4.7.1 into project which is on .netstandard 2.0.我正在尝试将使用 .NET Framework 4.7.1 构建的 nuget 安装到 .netstandard 2.0 上的项目中。 However, I am getting warning like但是,我收到警告,例如

Package 'xyz' was restored using '.NETFramework,Version=v4.7.1' instead of the project target framework '.netstandard2.0'. Package 'xyz' 是使用 '.NETFramework,Version=v4.7.1' 而不是项目目标框架 '.netstandard2.0' 恢复的。 This package may not be fully compatible with your project.此 package 可能与您的项目不完全兼容。

and nuget package is not getting installed correctly causing file missing exceptions when I run unit test cases.和 nuget package 在我运行单元测试用例时没有正确安装导致文件丢失异常。 I can see 2 options resolving this issue:我可以看到解决此问题的 2 个选项:

  1. I should change my original nuget package to support .NET Framework 4.7.1 as well .netstandard 2.0.我应该更改我原来的 nuget package 以支持 .NET Framework 4.7.1 以及 .netstandard 2.0。 Not sure if this is feasible?不确定这是否可行? If yes please let me know the steps.如果是,请告诉我步骤。

  2. Changes my nuget consumer project to use both of these versions.更改我的 nuget 消费者项目以使用这两个版本。 I have given couple of tries to figure out the way using above options but still not luck!我已经尝试过几次尝试找出使用上述选项的方法,但仍然没有运气!

Thanks all for your response.谢谢大家的回复。 I was able to figure out the solution by creating new .net standard project and migrating the .net framework code to it: Good Reference to brush up the basics about these .NET offerings : https://code-maze.com/differences-between-net-framework-net-core-and-net-standard/ I was able to figure out the solution by creating new .net standard project and migrating the .net framework code to it: Good Reference to brush up the basics about these .NET offerings : https://code-maze.com/differences-between-net -framework-net-core-and-net-standard/

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

相关问题 nuget 包中 .netstandard2.0 和 .netframework47 DLL 的混合 - .netstandard 不可用 - Mix of .netstandard2.0 and .netframework47 DLLs in nuget package - .netstandard not available VSTS构建任务在.NetFramework4.6.1项目引用.NetStandard2.0上失败 - VSTS build task fails on a .NetFramework4.6.1 project references .NetStandard2.0 在.netStandard2.0项目中添加“连接服务” - Add “Connected service” in .netStandard2.0 project 如何在 .NetStandard2.0 项目中定位 Windows? - How to target Windows in .NetStandard2.0 project? 在不同的 netstandard2.0 库 NU1202 中安装 netstandard2.0 Nuget 包 - Installing a netstandard2.0 Nuget Package inside a different netstandard2.0 library NU1202 ISystemClock 在 netstandard2.0 中不可用 - ISystemClock not available in netstandard2.0 .NetStandard2.0中的AsymmetricSecurityBindingElement在哪里? - Where is AsymmetricSecurityBindingElement in .NetStandard2.0? Project MyAzureFunc与netstandard2.0>(.NETStandard,Version = v2.0)不兼容 - Project MyAzureFunc is not compatible with netstandard2.0 > (.NETStandard,Version=v2.0) 无法在 Visual Studio 2019 中调试 .netstandard2.0 项目 - Cannot debug netstandard2.0 project in Visual Studio 2019 错误消息:Project Android.Common与netstandard2.0不兼容 - Error message:Project Android.Common is not compatible with netstandard2.0
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM