If you are like me you might have developed lots of web applications using different versions of the ASP.NET MVC framework, and might wonder how the latest installations may affect the ability to run.

When upgrading to the latest Release Candidate 2 these old projects will probably build just fine, but there will most likely be some kind of run time error when running locally, like the one I just got and showing below.


Why the breakage you might wonder and remembering that you been putting those old versions in your bin-folder and they should not be affected. Dylan Bettie gives us the explanation:

The CLR checks the GAC first when resolving assembly references - and if it finds a matching assembly in the GAC, it won't look anywhere else. The ASP.NET MVC previews and beta release all use the same assembly version, culture and public keys, so the CLR has no way of distinguishing between the preview 3 version of System.Web.Mvc and the beta version of the same assembly. They're different DLLs with different file versions, but because the assembly version is the same, the CLR regards them as the same assembly.

So what you need to do is to remove the ASP.NET MVC assemblies from your GAC and your old projects will run against the old ones in their bin.

Luckily I've done this before from the instructions in Dylans post and it's not that hard. Just make sure you backup your system before you do anything because it involves editing the registry which you knows is not always safe. For my safety I have just made a snapshot of my Windows 7 system I got running in WMware Fusion.

Remove the assembly from the registry

Firstly you need to run regedit and find HKEY_CLASSES_ROOT\Installer\Assemblies\Global and remove the key System.Web.Mvc,version="",culture="neutral", publicKeyToken="31BF3856AD364E35",processorArchitecture="MSIL"-key


Un-GAC it

Fire up a CMD prompt and locate your Gacutil.exe. On my Windows 7 system running team edition of Visual Studio 2008 it can be found here. C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin. Then run the command gacutil /u System.Web.Mvc


Test your projects

Your old projects made with the previews or betas should now run just fine as they will use the ddl:s you got in their respective bin folder. Mine is running fine as you can see.


By Jesper Lind