views:

338

answers:

1

I have a web application with a couple different sub-webs that use MVC. The problem I'm running into is that two of the sub webs use different MVC versions. One was recently upgraded to use the 1.0 version, and one is stuck on an earlier preview version.

After upgrading one of the sub-webs to 1.0, the other web that is using the preview version fails with the following error:

Could not load type 'System.Web.HttpContextWrapper2' from assembly 'System.Web.Abstractions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'

I suspect that the problem is due to the fact that both the 1.0 version and preview versions of the System.Web.Abstractions DLL are labeled as version 3.5.0.0, but actually contain different classes. So, when the preview app references System.Web.Abstractions, it gets the already loaded MVC 1.0 version instead of the preview version that is in its bin directory.

Is there any way I can force the runtime to load the assembly twice as if they were two different versions even though they are actually labeled with the same version number? I was looking into using the tag in my web config, but couldn't quite grok exactly how I would use that to do this, or if it would even achieve what I need to do here.

A: 

You could put System.Web.Abstractions.dll, System.Web.Mvc.dll and System.Web.Routing.dll assemblies with corresponding versions (from MVC preview and from MVC 1.0) in ~/bin folders of each of your sub-webs.

UPDATED:

Try removing this from web.config of your App using ASP.NET MVC Preview version:

<system.web>
    <assemblies>
        <!--<add assembly="System.Web.Abstractions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />-->
    </assemblies>
eu-ge-ne
Not sure what you mean here. 3.5 SP1 is installed on the servers, so MVC 1.0 is there for all apps already. The app that needs the preview version has the preview bins in its /bin folder, but it seems they are being ignored because SP1 puts the 1.0 bins in the GAC (and the preview bins have the same version number)
Eric Petroelje
Did you try removing <add assembly .. /> for Abstractions/Mvc/Routing from web.config/system.web/compilation/assemblies section for Application using ASP.NET MVC Preview?
eu-ge-ne
@eu-ge-ne - yes, just tried that and it didn't have any effect. Still getting the same error message as before.
Eric Petroelje