1

I have an MVC3 app which depends on the DotNetOpenAuth lib, which references MVC1. When I installed the DotNetOpenAuth NuGet package it added an assembly binding redirect to my web.config. I uncommented it, but nothing changed.

After some searching I found that the reason for this is usually a typo, however I doubt this applies to me, I checked the config at least a dozen times for typos.

I stripped down my web.config to the following:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
            <dependentAssembly>
                <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
                <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
            </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

During build I get the following warning:

Consider app.config remapping of assembly "System.Web.Mvc, Culture=neutral, PublicKeyToken=31bf3856ad364e35" from Version "1.0.0.0" [] to Version "3.0.0.0" [C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 3\Assemblies\System.Web.Mvc.dll] to solve conflict and get rid of warning.
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1578,5): warning MSB3247: Found conflicts between different versions of the same dependent assembly.

I have tried a lot of different combinations (eg. adding the culture="neutral" attribute) in my web.config with no luck, and I've run out of ideas. Any suggestions?

Update My ~/Views/web.config is here

Hari
  • 4,514
  • 2
  • 31
  • 33
  • Can we see your `~/Views/web.config` as well? Remember that `` references the `System.Web.Mvc` library – Brad Christie Oct 30 '13 at 12:55
  • @BradChristie Sure, I added a pastebin link to the question – Hari Oct 30 '13 at 13:08
  • Does the NuGet package bring over/include the System.Web.Mvc.dll when you brought it in? It could be that you have two copies being deployed with your project and causing the issue - http://stackoverflow.com/questions/17806/warning-found-conflicts-between-different-versions-of-the-same-dependent-assemb (2nd answer) – Tommy Oct 30 '13 at 15:22
  • @Tommy Yes the package references MVC1 and that is the root of the problem because my app references MVC3. I would like to use the official package (I know rebuilding it with an MVC3 reference would solve the issue). I understand the warning and I understand why do I get it, what I don't understand is: I do what it hints to do and I still get it during build. Why? – Hari Oct 31 '13 at 10:24

1 Answers1

2

In a similar situation, with .NET Framework 4.5 projects, Visual Studio 2013 recently pointed me into this MSDN article:

How to: Enable and Disable Automatic Binding Redirection

BTW: it worked for us, at least when running build from VS. Instead it had no effect when running the build from a command line script.

superjos
  • 12,189
  • 6
  • 89
  • 134
  • Thanks for the tip, I will try it next time I have to touch that blasted project again (=hopefully never). – Hari Aug 27 '14 at 15:33