- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个针对 .Net Framework 4.8 的项目。现在,我们需要使用第 3 方 dll。问题是 dll 是针对 .Net Standard 2.1 的。
有没有办法在 .Net Framework 4.8 项目中使用这个 dll?
我添加了dll,得到这个错误:
Could not load file or assembly 'netstandard, Version=2.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.
我搜索了,似乎它应该直接工作。也许我需要添加一个引用?不确定现在需要做什么。
最佳答案
您不能在任何 .Net Framework 版本中使用 .Net Standard 2.1 程序集,因为 .NET Framework(甚至是最后一个版本,4.8)没有实现 .Net Standard 2.1。
.Net Standard .NET 实现支持矩阵位于 https://docs.microsoft.com/en-us/dotnet/standard/net-standard在“框架”下不包含 2.1 的条目。
有关 MS 决定的更多详细信息:https://devblogs.microsoft.com/dotnet/announcing-net-standard-2-1/
提炼:
Given many of the API additions in .NET Standard 2.1 require runtimechanges in order to be meaningful, .NET Framework 4.8 will remain on.NET Standard 2.0 rather than implement .NET Standard 2.1. .NET Core3.0 as well as upcoming versions of Xamarin, Mono, and Unity will be updated to implement .NET Standard 2.1.
Library authors who need to support .NET Framework customers shouldstay on .NET Standard 2.0. In fact, most libraries should be able tostay on .NET Standard 2.0, as the API additions are largely foradvanced scenarios. However, this doesn’t mean that library authorscannot take advantage of these APIs even if they have to support .NETFramework. In those cases they can use multi-targeting to compile forboth .NET Standard 2.0 as well as .NET Standard 2.1. This allowswriting code that can expose more features or provide a more efficientimplementation on runtimes that support .NET Standard 2.1 while notgiving up on the bigger reach that .NET Standard 2.0 offers.
Starting with .NET Standard 2.0, the .NET Framework compatibility modewas introduced. This compatibility mode allows .NET Standard (*) projectsto reference .NET Framework libraries as if they were compiled for.NET Standard. Referencing .NET Framework libraries doesn't work forall projects, such as libraries that use Windows PresentationFoundation (WPF) APIs.
关于c# - 如何在 .Net Framework 4.8 中使用 .Net Standard 2.1 DLL?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63588099/
我是一名优秀的程序员,十分优秀!