[英]Unity error CS1705: which has a higher version than referenced assembly
I have a .dll that I made with .NET 6 and I want to use it as a dependency on an Unity project on Linux and using mono as compiler.我有一个用 .NET 6 制作的 .dll,我想将它用作 Linux 上 Unity 项目的依赖项,并使用 mono 作为编译器。 The problem is that when Unity loads the .dll it throws this error:
问题是当 Unity 加载 .dll 时会引发此错误:
error CS1705: Assembly 'DominoEngine' with identity 'DominoEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' uses 'System.Runtime, Version=6.0.0.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'
错误 CS1705:具有标识“DominoEngine,版本=1.0.0.0,文化=中性,PublicKeyToken=null”的程序集“DominoEngine”使用“System.Runtime,版本=6.0.0.0,文化=中性,PublicKeyToken=b03f5f7f11d50a3a”版本比引用的程序集 'System.Runtime' 标识为 'System.Runtime, Version=4.1.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
I've seen people with similar issues around but I can't get to a solution for this我见过有类似问题的人,但我无法找到解决方案
I recommend you build the DLL in a .Net Standard 2.0 project.我建议您在 .Net Standard 2.0 项目中构建 DLL。 In your visual studio solution, create a new Project and choose .Net Standard 2.0 Library as the project type.
在您的 Visual Studio 解决方案中,创建一个新项目并选择 .Net Standard 2.0 Library 作为项目类型。 Move your code into there.
将您的代码移到那里。 You can still have a 6.0 EXE project that references that assembly, and then you can also use that assembly anywhere including Unity.
您仍然可以拥有一个引用该程序集的 6.0 EXE 项目,然后您还可以在任何地方使用该程序集,包括 Unity。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.