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.

2
  • It sounds like you have a copy in the Bin and in GAC. Do you have a copy of System.Web.Mvc in your bin folder (make sure you're viewing all the files) Commented Jun 2, 2009 at 19:25
  • I reference the source project, so after compiling there will be a copy in my bin. Commented Jun 2, 2009 at 19:51

6 Answers 6

7

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:

Sign up to request clarification or add additional context in comments.

1 Comment

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!
1

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.

1 Comment

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.
1

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.

3 Comments

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.
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.
According to the codeville article make sure your project reference to system.web.mvc is set "Copy Local" to "true"
0

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>

Comments

0

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.

1 Comment

read and followed it, the web.config in my view is different from the one in the article
0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.