如何管理重复的程序集引用C#Unity/如何使用标志编译C#项目



我正在尝试集成RosSharp(https://github.com/siemens/ros-sharp)将混合现实工具包整合为一个Unity项目。然而,这两个库都使用Newtonsoft.Json,这会导致错误:

error CS1703: An assembly `Newtonsoft.Json' with the same identity has already 
been imported. Consider removing one of the references
Assets/HoloToolkit/Utilities/Scripts/GLTF/Plugins/JsonNet/Newtonsoft.Json.dll 
(Location of the symbol related to previous error)
Assets/RosSharp/Plugins/Newtonsoft.Json.dll (Location of the symbol related to 
previous error)

删除其中一个DLL将导致许多其他错误。

通过开发人员文档查找此错误(https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-messages/cs1703):建议我使用以下标志编译项目:/t:library /out:.bin2cs1703.dll /keyfile:key.snk

如何在Visual中编译带有特定标志的C#解决方案。

我相信这个问题也可以使用外部别名来解决,尽管我不知道这些别名是如何实现的。

事实证明,我需要使用正确的Unity Version-2017和(在我的情况下为2017.4.16(,在Visual Studio中,我还需要转到Project>Manage NuGet包并更新我的Newtonsoft包。

最新更新