views:

690

answers:

6

Trying to debug into ASP.NET MVC 1.0 source, I followed instructions like these, basically remove reference to system.web.mvc from my web project and add the source project I downloaded instead.

Now, I have this problem,

The type 'System.Web.Mvc.FormMethod' exists in both 'c:\Windows\assembly\GAC_MSIL\System.Web.Mvc\1.0.0.0__31bf3856ad364e35\System.Web.Mvc.dll' and in my AppData\Local\Temp\Temporary ASP.NET Files\root\dbcbb149\897fc019\assembly\dl3\796c00fb\f345f2d6_abe3c901\System.Web.Mvc.DLL'

I tried commenting out the following from web.config

<add assembly="System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />

but it'll give a difference error

The type 'System.Web.Mvc.Controller' 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'.

Could someone help on what's going wrong and how to fix it. Thank you very much!

Ray.

+1  A: 

Are the system.web.mvc assemblies in the GAC? you might need to remove them ... this of course could mess up future projects as the project templates will likely assume that they are in the gac.

You could also try using the <assemblyBinding> feature as described here to point the mvc stuff to the version that you are running.

Joel Martinez
Yes, I installed mvc using the Web PI, so it's in GAC. Is there a simpler way to solve this. I really don't want to remove it from GAC or uninstall it.
ray247
+1  A: 

Assuming the fully qualified assembly name for the one you're linking to differs from the one in the GAC, use the <QualifyAssembly> element and specify which assembly you're actually linking to. If not, change your local source to change the MVC assembly you're building to 1.0.0.1 so it is different.

Edit: Double check the howto you linked. It worked for me.

  1. removed the system.web.mvc reference in my project.
  2. Added the System.Web.Mvc project from source.
  3. Comment out the System.Web.Mvc reference in my project's web.config.
  4. modified the System.we.b.mvc's /Views/Web.Config as stated in the howto.
  5. Ran flawlessly.
hometoast
Don't quite know how this works, do you have the exactly <qualifyassemble> line that I could use to make this work. Tried to change it to 1.0.0.1, didn't really work.
ray247
See Richard's answer and you'll likely have to update the assembly info for the mvc project so that the version is different from the one in the GAC.
hometoast
According to the codeville article make sure your project reference to system.web.mvc is set "Copy Local" to "true"
hometoast
yeah, it is set to "true"
ray247
A: 

for the qualify assembly section you want something like this (we do it for SQLite assembly):

 <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <qualifyAssembly partialName="System.Data.SQLite" fullName="System.Data.SQLite, Version=1.0.60.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139" />
    </assemblyBinding>
  </runtime>
Richard
A: 

Have a look at this article for the complete guide on how to setup MVC source.

There are two web.config files you need to update. One is in the MVC project folder and one is in the Views folder. It's likely you forgot to update the latter. Otherwise following the aforementioned article should do it.

aleemb
read and followed it, the web.config in my view is different from the one in the article
ray247
+4  A: 

There is no need to uninstall ASP.NET MVC from GAC! (or any any <assemblyBinding>s) Just follow "Using the ASP.NET MVC source code to debug your app" article step by step.

There are a couple of questions similar to yours:

eu-ge-ne
I see where I missed, your 2nd link helped, the <page need all to be null. I followed the tutorial to begin with, but I think it only mentioned one attrib in <page tag to be null. Thanks!
ray247
A: 

A slightly more comprehensive version of Steve Sandersons instructions can be found here.

It explains how you can also include MVC Futures in your debugging.

Stuart