Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

System.Reflection multiple assemblies error after update

After updating .NET Framework NuGet packages that my solution references to last prerelease version. I've got a building error:

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.

I can't figure out how resolve this issue. If I remove System.Reflection using NuGet it throws reference error exception, it wants 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.

How can I remove a duplicate?

like image 488
AsValeO Avatar asked Mar 14 '23 02:03

AsValeO


1 Answers

The problem was solved by changing this line in app.config:

<bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" />

to

<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />

Managing .NET Framework packages in Visual Studio projects is messy. Information about references exists in .csproj / .vbproj, app.config, packages.config.

like image 91
AsValeO Avatar answered Mar 25 '23 06:03

AsValeO