警告 MSB3277:发现不同版本的“Microsoft.CSharp”之间存在无法解决的冲突

问题描述

我一直拖着这个构建警告很长一段时间,我想在构建我的 Xamarin.Forms.Ios 项目时摆脱它。

我收到警告

"/应用程序/视觉 Studio.app/Contents/Resources/lib/monodevelop/bin/MSBuild/Current/bin/Microsoft.Common.CurrentVersion.targets(5,5): 警告 MSB3277:发现不同版本之间的冲突 无法解析的“Microsoft.CSharp”。这些参考 当日志详细程度设置为时,冲突会在构建日志中列出 详细的。 (MSB3277) (BB.App.iOS)"

在构建日志中,我找到了以下语句。

There was a conflict between "Microsoft.CSharp,Version=2.0.5.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a" and "Microsoft.CSharp,Version=4.0.0.0,PublicKeyToken=b03f5f7f11d50a3a".
        "Microsoft.CSharp,PublicKeyToken=b03f5f7f11d50a3a" was chosen because it was primary and "Microsoft.CSharp,PublicKeyToken=b03f5f7f11d50a3a" was not.
        References which depend on "Microsoft.CSharp,PublicKeyToken=b03f5f7f11d50a3a" [/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/Xamarin.iOS/Microsoft.CSharp.dll].
            /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/Xamarin.iOS/Microsoft.CSharp.dll
              Project file item includes which caused reference "/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/Xamarin.iOS/Microsoft.CSharp.dll".
                Microsoft.CSharp
        References which depend on "Microsoft.CSharp,PublicKeyToken=b03f5f7f11d50a3a" [].
            /Users/sjorsmiltenburg/.nuget/packages/automapper/10.0.0/lib/netstandard2.0/AutoMapper.dll
              Project file item includes which caused reference "/Users/sjorsmiltenburg/.nuget/packages/automapper/10.0.0/lib/netstandard2.0/AutoMapper.dll".
                /Users/sjorsmiltenburg/.nuget/packages/automapper/10.0.0/lib/netstandard2.0/AutoMapper.dll
                /Users/sjorsmiltenburg/_Sources_BookaBooka/BB.App/BB.App/bin/Debug/netstandard2.0/BB.App.dll

我可以找到类似的问题 on android,但这里的原因与 newtonsoft.json 引用旧的 CSharp.dll 有关。

在这里读到的是 Automapper 引用了 Microsoft.CSharp 4.7(我可以在我的主项目的 nuget 引用中找到它),但我无法弄清楚 Microsoft.CSharp 2.0.5.0 引用来自哪里。

我可以在我的主项目中深入了解 nuget - 参考树,但不能在我的 XF.ios 项目中深入了解。在我的 ios.proj 文件中,我没有发现对 CSharp.dll 的引用

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)