【发布时间】:2018-03-30 07:46:23
【问题描述】:
由于我需要导入一个面向 .NET Standard 2 的库,我已将我的库升级到 .NET 4.7.1,正如我从这个 MS 视频中了解到的那样,应该避免这个问题:https://www.youtube.com/watch?v=u67Eu_IgEMs
但是,添加 .NET 标准现在会导致数十个 System.xxx 引用,而不是对 .NET Standard 的单个引用(根据视频)。
更糟糕的是,添加了几个引用,但基础文件似乎缺少生成警告,例如
Warning The referenced component 'Microsoft.Win32.Primitives' could not be found.
Warning The referenced component 'System.IO.FileSystem' could not be found.
Warning The referenced component 'System.Security.Cryptography.X509Certificates' could not be found.
Warning The referenced component 'System.Globalization.Calendars' could not be found.
我什至在视频中重新创建了演示项目并得到了相同的结果 - 没有对 .NET Standard 的单一引用,而是大量的 DLL 引用。
Warning The referenced component 'System.Security.Cryptography.Encoding' could not be found.
Warning The referenced component 'System.Security.Cryptography.Primitives' could not be found.
Warning The referenced component 'System.IO.Compression.ZipFile' could not be found.
Warning The referenced component 'System.Console' could not be found.
我已尝试使用 NUGET update-package -reinstall 并降级并升级到 .NET 标准 2.0 和 2.0.1
【问题讨论】:
-
this GitHub issue 是你遇到的吗?
-
不确定是@FrankFajardo,但感谢您的指点。它指的是 4.6.1,我知道它不支持 netstandard 2.0。我尝试在 MS 视频中创建演示应用程序(一个引用 .netstd 2 库的控制台应用程序,并得到了类似的结果 - 所以我认为这一定是 netstd 支持的问题..
-
没有什么可以“参考”与 .NET Standard 相关的,它是一个“目标”。库目标只是声明其 API 兼容性。因此,不清楚您要做什么或要问什么。
-
此外,您列出的缺失项是 .NET Framework(特定于 Windows),因此 .NET Standard 库无法引入这些依赖项。
-
@McGuireV10 我正在引用一个以 netstandard 作为目标的库,来自一个目标为 4.7.1 的库。- 应该 意味着它不会创建大量 shim库,但它没有
标签: c# .net .net-standard-2.0