简体   繁体   English

.NET Framework:如何更新 System.Runtime?

[英].NET Framework: How to update System.Runtime?

I have a DLL compiled from a project of type "Class Library" which has a target framework of netcoreapp3.1 (EDIT: now netstandard2.0 ).我有一个从“类库”类型的项目编译的 DLL,它有一个目标框架netcoreapp3.1 (编辑:现在netstandard2.0 )。

I then reference this DLL in another project, a Windows Forms application, which targets .NET Framework 4.7.2 (EDIT: now 4.8 ).然后我在另一个项目中引用这个 DLL,一个 Windows 窗体应用程序,它针对 .NET Framework 4.7.2 (编辑:现在4.8 )。

When trying to compile the Windows Forms application, I get the following error:尝试编译 Windows 窗体应用程序时,出现以下错误:

Error CS1705: Assembly 'BC' with identity 'BC, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' uses 'System.Runtime, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' which has a higher version than referenced assembly 'System.Runtime' with identity 'System.Runtime, Version=4.1.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'

I would like to update System.Runtime on the WinForms project to use version 4.2.2.0 (which is apparently required by my DLL), however, I found no way to do so - there are no NuGet packages installed and the references section in Visual Studio doesn't seem to include System.Runtime directly:我想更新 WinForms 项目上的System.Runtime以使用版本 4.2.2.0(这显然是我的 DLL 所需要的),但是,我发现没有办法这样做 - 没有安装 NuGet 包和 Visual 中的引用部分Studio 似乎没有直接包含System.Runtime

引用列表截图,System.Runtime 没有出现在列表中

How do I update System.Runtime and resolve the error?如何更新System.Runtime并解决错误?

Try any of the following:尝试以下任一方法:

  • Upgrade your WinForms project to .NET 4.8, because there have been a lot of compatibility fixes in that release.将您的 WinForms 项目升级到 .NET 4.8,因为在那个版本中有很多兼容性修复。 .NET 4.8 still has issues when interfacing with .NET Core libs, but many problems will just be gone. .NET 4.8 在与 .NET Core 库接口时仍然存在问题,但很多问题都会消失。

  • Or try changing your library to .netstandard2.0.或者尝试将您的库更改为 .netstandard2.0。 Then it should always be compatbile to Net Framework.那么它应该始终与 Net Framework 兼容。

For best compatiblity, try doing both: Setting the library to .netstandard2.0 and change the WinForms app to .NET 4.8.为获得最佳兼容性,请尝试同时进行:将库设置为 .netstandard2.0,并将 WinForms 应用程序更改为 .NET 4.8。

暂无
暂无

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

相关问题 .NET WinForms:无法加载 System.Runtime - .NET WinForms: Cound not load System.Runtime ASP.NET:由Nuget引起的.NET Framework /标准/核DLL冲突。 “你必须添加对程序集System.Runtime的引用......” - ASP.NET: .NET Framework/Standard/Core DLL collisions, caused by Nuget. “You must add a reference to assembly System.Runtime…” 如何将项目从System.runtime 4.0.10.0更新到4.0.20.0 - How can I update my project from System.runtime 4.0.10.0 to 4.0.20.0 ASP.NET Core 2.0站点-FileIOException System.Runtime - ASP.NET Core 2.0 Site - FileIOException System.Runtime C# .NET“无法加载文件或程序集 System.Runtime” - C# .NET "Could not load file or assembly System.Runtime" .Net Core MVC应用程序中的System.Runtime引用 - System.Runtime reference in .Net Core MVC application 无法使用.Net Core dll加载文件或程序集'System.Runtime' - Could not load file or assembly 'System.Runtime' with .Net Core dll 由于 System.Runtime 错误,无法将 Blazor 应用程序迁移到 .Net 5 - Cannot Migrate Blazor App to .Net 5 Due to System.Runtime Error 如何解决“System.Runtime”和“netstandard”中都存在“AssemblyCompanyAttribute”类型? - How to resolve The type 'AssemblyCompanyAttribute' exists in both 'System.Runtime,' and 'netstandard'? CS1703:在Xamarin.Droid中,我应该使用位于Mono.Framework或System.Runtime中的.Net Standard windowsruntime.dll吗? - CS1703: In Xamarin.Droid, should I use the .Net Standard windowsruntime.dll located in Mono.Framework, or System.Runtime?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM