Question

I'm using Combres with my MVC 3 RC project and getting an an assembly binding error when I deploy it to my web server.

System.IO.FileLoadException
Could not load file or assembly 'System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

<%= Html.CombresLink("commonJs") %>

My development machine has the MVC 1 and 2 assemblies in the GAC, so it works fine there. The web server doesn't have any version of MVC in the GAC, and I'm bin-deploying the MVC 3 assembly. My project references version 3.0.0.0 of System.Web.Mvc, and I have the following section in my web.config:

<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <dependentAssembly>
            <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
            <bindingRedirect oldVersion="1.0.0.0" newVersion="2.0.0.0" />
        </dependentAssembly>
        <dependentAssembly xmlns="">
            <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
            <bindingRedirect oldVersion="2.0.0.0" newVersion="3.0.0.0" />
        </dependentAssembly>
    </assemblyBinding>
</runtime>

I thought that this section would tell Combres to use version 3.0.0.0 instead. Why is my application failing to resolve the reference?

Was it helpful?

Solution

I don't think the binding redirect will chain - you have a reference to 1.0 somewhere, and your config tells it to load 2.0, which does not exist.

You need just one binding redirect with oldVersion set to "1.0.0.0-2.0.0.0"

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top