Resolving MSB3247 conflicts between different versions - when binding redirects already exist
Asked Answered
S

0

6

Does anyone have any idea why we'd get MSB3247 assembly version errors (which recommend a binding redirect), when the binding redirect is already there?

We've done the usual check with MSBuild detailed errors and AsmSpy to check this.

The error in the diagnostics logs from MSBuild indicates:

C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(1635,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: 
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Web.Mvc" culture="neutral" publicKeyToken="31bf3856ad364e35" /><bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" /></dependentAssembly></assemblyBinding> [Z:\PathTo\WebProject.csproj]

In our web.config for WebProject.csproj we have:

  <dependentAssembly>
    <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
  </dependentAssembly>

On our development machines and current build servers, we don't receive the error. But on some brand new build machines we're setting up, we're seeing it. I'm thinking this could be related to .NET 4.5.1 or the new separated out MS Build tools package?

I can't for the life of me figure out why it's not happy - any tips on debugging this (bearing in mind we're on a machine with build tools only!)

Stonge answered 4/4, 2014 at 13:50 Comment(4)
Any luck on this one James? I'm having the same issue.Yettayetti
@AndrewDuffy I'm afraid not... still on my list to look into again but no success previously. Do let me know if you find a solution too...Stonge
I realize this is a very old question, but I can confirm it is a difference between compiling from MSBuild 12 and 15. It just came to my attention because I'm having the same problem with a web project that I am moving from VS2013 to VS2017, and as in your problem, I did similar edits in the dependentAssembly section of web.config with no effect.Ordeal
I'm seeing these warnings even with Visual Studio 2022 and MS Build for either VS 2019 or VS 2022 (I'm not entirely sure what version in on the CI runner). And worse, assembly binding errors at runtime after the CI runner deploys the app! I guess the warnings should be errors, or I've got other problems.Kif

© 2022 - 2024 — McMap. All rights reserved.