44

How can I determine where to fix this reference without adding a binding to the app.config?

Consider app.config remapping of assembly "System.Runtime.Serialization.Primitives, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" from Version "4.1.1.0" [] to Version "4.1.2.0" [F:\Production\packages\System.Runtime.Serialization.Primitives.4.3.0\lib\net46\System.Runtime.Serialization.Primitives.dll] to solve conflict and get rid of warning. 12>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(1820,5): warning MSB3247: Found conflicts between different versions of the same dependent assembly. In Visual Studio, double-click this warning (or select it and press Enter) to fix the conflicts; otherwise, add the following binding redirects to the "runtime" node in the application configuration file:

wonea
  • 4,783
  • 17
  • 86
  • 139
Mike Flynn
  • 22,342
  • 54
  • 182
  • 341
  • More recent, but I had this problem *because* of the existing `app.config`. Just deleting fixed the problem. – Benjol Mar 24 '23 at 10:17

5 Answers5

53

How can I determine where to fix this reference without adding a binding to the app.config?

You can try to change the "MSBuild project build output verbosity" to "Detailed" or above to check the detail error log. To do this by Tools -> Options...->Projects and Solutions->Build and Run. Set the MSBuild project build output verbosity level to Detailed or above. Build the project and checkout the error log in the output window. The ResolveAssemblyReferences task, which is the task from which MSB3247 originates, should help you debug this particular issue.

enter image description here

Then go to the project with the older version, removed the reference, then added the correct reference.

Leo Liu
  • 71,098
  • 10
  • 114
  • 135
  • Not so sure this answer is useful. The ResolveAssemblyReferences task just outputs that you need to use app.config. Something that OP specified he doesn't want to do. – PerfectContrast Dec 15 '22 at 09:08
  • It was useful enough to completely outline a direction to take in the detailed output (well... one option) in the log... It said to insert the following in my case... and replacing the entry in the app config Runtime/AssemblyBinding element was the fix for my situation... – Hunter-Orionnoir Mar 03 '23 at 05:32
11

I solved this by targeting a higher .NET Framework version. Switched from 4.7 to 4.7.2 and the warnings went away. The warnings started after I switched from EF6 to EF.Core.

Wai Ha Lee
  • 8,598
  • 83
  • 57
  • 92
Matthias Güntert
  • 4,013
  • 6
  • 41
  • 89
7

The real problem is that the References in the .csproj file are not updated when doing a nuget update, hence the warning to override these in the app.config. If you update the .csproj, all warnings go away.

balint
  • 3,391
  • 7
  • 41
  • 50
  • I also had a duplicate NewtonSoft.Json in web.config. I manually removed the outdated entry. I think this order will avoid the error: Update NewtonSoft to desired version (ex, 8.0.0 to 11.0.2), update project to target newer version of .net framework, (ex, 4.5.1 to 4.7.2). – No Refunds No Returns Aug 16 '21 at 12:12
  • This fixed it! I was targeting Version=20.2.5 of an assembly when I've already upgraded to Version=20.2.9. – Tea Feb 03 '22 at 16:42
1

I began getting the error when I upgraded the Microsoft Identity packages (via NuGet). Some of the version numbers were not updated in the <runtime> node of the web.config file. I found this fix by following Leo Liu-MSFT's instructions (above).

Bill Matsoukas
  • 153
  • 1
  • 5
0

I ended up fixing this issue by adding <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> to my csproj file.

You can find out more here: How to: Enable and disable automatic binding redirection

Skint007
  • 195
  • 5
  • 15