将我的解决方案引用的 .NET Framework NuGet 包更新为上一个预发布版本。我有一个构建错误:
Multiple assemblies with equivalent identity have been imported: 'C:\Projects\RP\packages\System.Reflection.4.1.0-beta-23516\lib\net46\System.Reflection.dll' and 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.6\Facades\System.Reflection.dll'. Remove one of the duplicate references.
我不知道如何解决这个问题。如果我使用 NuGet 删除 System.Reflection,它会抛出引用错误异常,它需要 System.Reflection v.4.1.0.0。
Could not load file or assembly 'System.Reflection, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
如何删除重复项?
最佳答案
通过更改 app.config
中的这一行解决了问题:
<bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" />
到
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
在 Visual Studio 项目中管理 .NET Framework 包很麻烦。
有关引用的信息存在于 .csproj
/.vbproj
、app.config
、packages.config
中。
关于c# - 更新后 System.Reflection 多个程序集错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33895816/