6

I have a project that references the System.Web.Mvc assembly in the GAC. I also have the ASP.NET MVC source code from Codeplex. I want to get a better understanding of the DefaultControllerFactory by stepping through its methods. How could I set this up?

Thanks!

Michiel van Oosterhout
  • 22,839
  • 15
  • 90
  • 132

3 Answers3

3
  1. Compile the MVC code.
  2. Uninstall the MVC (To make sure you don't debug the retail bits)
  3. Use the assembly that you compiled, instead of the retail.
Shay Erlichmen
  • 31,691
  • 7
  • 68
  • 87
  • 1
    This is mostly right (upvoted), but you don't need to completely uninstall MVC. You can just remove it from the GAC and bin deploy your compiled assembly. Uninstalling would remove the tooling support, which you don't really want to do. – Craig Stuntz Mar 31 '09 at 15:43
  • When something is put in the GAC is has a dependency to something (File, Setup, etc) if that dependency exists (File still exits, setup not uninstalled) you cannot remove the assembly from the GAC. You can, however delete the file by finding is *real* path, but uninstall is simpler. – Shay Erlichmen Mar 31 '09 at 15:48
  • (Cont) but I think it is much simpler to uninstall, and install it once your done with it. – Shay Erlichmen Mar 31 '09 at 15:49
  • 1
    You can remove MVC from the GAC; we've done it (registry hack). Like I said, uninstall removes too much. – Craig Stuntz Mar 31 '09 at 17:31
  • 1
    Thanks, I didn't uninstall ASP.NET MVC, I just removed the reference to the GAC assembly and referenced the built assembly from the source. When I start debugging I have to select the source file and then it works. – Michiel van Oosterhout Apr 01 '09 at 10:26
  • Bonus question: I did this and it worked, but now I can't use third party assemblies that also reference ASP.NET MVC such as MVCContrib. I get error messages like this one: Error 1 The type 'System.Web.Mvc.HtmlHelper' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Any idea how I might be able to fix this? Thanks, Adrian – Adrian Grigore May 05 '09 at 17:44
  • Other then compile also MVCContrib or use this: http://www.codeproject.com/KB/security/StrongNameRemove20.aspx, I'm afraid that your pretty limited. – Shay Erlichmen May 05 '09 at 19:35
1

If you do download the MVC source files from Codeplex, I've written a step by step guide on how to debug the System.Web.Mvc assembly, which you may find useful.

Steve Moss
  • 11
  • 1
0

Your assemblies may be compiled in Release even if the Solution Configuratin drop down says Debug. It also may be that w3p.exe loaded your release assemblies.

1 -Use the Build->Configuration manager feature and make sure all of the project configurations are Debug. 2 - Build Clean 3 - Rebuild Solution 4 - iisreset (unloads Release assemblies if they're loaded) 5 - Invoke a page 6 - Attach process

hopefully the solid red circles show up now - best of luck