views:

111

answers:

2

I have made a relatively simple change to the MVC 1.0 source code to correct a bug in the DropDownList HtmlHelper (discussed in another question).

I was able to rebuild the MVC solution, ran all the tests, including the one I hadd added to show the bug I was fixing, and built a new DLL.

But how do I use that?

I tried moving the new MVC dll into the project and changing all the project references to point to it, but when I try to run the MVC website, it's throwing an exception saying there's a conflict between my version of MVC and the MVC in the GAC.

I tried to use gacutil.exe to remove the one from the GAC, but it says it can't do that because it would make another program (the Microsoft Installer? fail.

What do I have to do to install my newly built version in place of the "official" version?

A: 

How about changing the version number when you compile the modified MVC framework?

UpTheCreek
+1  A: 

If you want to remove it from the GAC without uninstalling MVC (which includes the Visual Studio templates you probably need), you need to do this in the registry:

  • Find registry key HKEY_CLASSES_ROOT\Installer\Assemblies\Global and look for key starting with System.Web.Mvc – delete it

Now you should be able to use gacutil.exe to remove System.Web.Mvc from the GAC, and you should be able to use your version from your /bin folder.

JonoW
Thanks, Jono, that did it.
Dave Hanna
Okay, that gets MVC out of the GAC and alleviates the conflict, but I still have parts of the code trying to load that version. Specifically, BuildManger.CreateInstanceFromVirtualPath throws an exception saying that it can't "load MVC version 1.0.0.0, public token= ... the manifest definition does not match the assembly reference"I've taken the assembly reference out of web.config and replaced it with a generic "add name="System.Web.Mvc" (without the details). Do I need an assembly re-direct, or something? What else do I need to do to get it to accept the new version throughout?
Dave Hanna
Okay, I got it. I had changed the assembly references in the root web.config, but missed the fact that the View folder has a web.config in it, and it had some fully-qualified references that I had to change. Once I did that, it worked.
Dave Hanna
I think you need the entries in web.config, in the system.web/compilation/assemblies section. Maybe try add that again. Have you strongly named the assmebly? Make sure your PublicKeyToken matches
JonoW
Ah nice one, see you got it working, ignore my last comment then...
JonoW