14

I download the latest source code from here: http://aspnetwebstack.codeplex.com/SourceControl/list/changesets

1) add the system.web.mvc project to my Solution including other projects that system.web.mvc project depends on.

https://public.blu.livefilestore.com/y1pWkk8-pYVhCxrqVp3WTurqXOI290cw7uGMfrKYoVDARFINGaaYgENPsoj_U1ukH3plg9O29-YiDkxBuSxMv8JWg/1%201.jpg?psid=1

2) change the reference of system.web.mvc assembly in the "CollaborativeDesign.WebUI","CollaborativeDesign.Domain","CollaborativeDesign.UnitTest" project from the GAC one to the system.web.mvc project.

https://public.blu.livefilestore.com/y1phd1RsSEDGBZU_w6ke0NNw19sa51cXXsYTPB05yhKiNYPq_Hr1kdllejvrxMdDjGBHR0H94GOglRvt-1MUAA7ng/2.jpg?psid=1

3) change the root Web.config file as following show:

https://public.blu.livefilestore.com/y1pKu-Q0K765sayJazkM8OLmC-r-Kj2lkkq5fs6M0Kl6YwN5CtVvKYFzrmdkyj8oMIboOWPpBnDnt5mabIoAZuhTw/3.jpg?psid=1

https://public.blu.livefilestore.com/y1pi3d9IWgFkCpnornqTMs4OQTBdC2IDL3YL2A51DFdjYE4wFcn_-NYKMjLYtl2PjCYedngHZ5sSblOlFj-zIrnUg/4.jpg?psid=1

4) change the Web.config file in the "View" directory as following show:

<!--<pages validateRequest="false" pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
  <controls>
    <add assembly="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" />
  </controls>
</pages>-->
<pages validateRequest="false" pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null" pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null" userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null">
    <controls>
        <add assembly="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null" namespace="System.Web.Mvc" tagPrefix="mvc" />
    </controls>
</pages>

5) when I run the project, it looks like still using the GAC system.web.mvc.dll, because when I set the breakpoint in the "Controller.cs" file which is in the "system.web.mvc" project, it shows that it doesn't load any symbol for the document, and I also can't step into the method of mvc source code.

https://public.blu.livefilestore.com/y1pgt_xkjJLw3bPFj6R6z2EAyqxCYC4Yk0cfYUe4RCUEkYT9EQPb56CZ1qKVI8_zGBoRe5VcFcRjmNjnc24hFmyDw/5.jpg?psid=1

How can I debug the source code ? How can I know that the loaded system.web.mvc.dll is the GAC one or my local one ?

4
  • You need to Strong Named the assembly or the GAC will win. see web.lookout.net/2006/04/… Commented Mar 31, 2012 at 18:43
  • @Rick.Anderson-at-Microsoft.com Commented Apr 1, 2012 at 0:26
  • @Rick.Anderson-at-Microsoft.com But the System.web.mvc.dll which is the output of system.web.mvc project is already Strong Named. see link Commented Apr 1, 2012 at 0:37
  • @OwenOu It looks like you edited the answer into your question, but you should have posted that as an answer. Commented Apr 1, 2012 at 5:19

3 Answers 3

8

Accroding to the @Rick.Anderson-at-Microsoft.com's comment, I have been resolve this problem by doing the following additional steps:

1> Run "sn.exe -Vr *,31BF3856AD364E35" in the Visual Command line

2> Change the "AssemblyVersion" and "AssemblyFileVersion" in the CommonAssemblyInfo.cs which is in the System.Web.Mvc project from "4.0.0.0" to "4.0.0.1". Rebuild the project.

#if ASPNETMVC
[assembly: AssemblyVersion("4.0.0.1")]
[assembly: AssemblyFileVersion("4.0.0.1")]
[assembly: AssemblyProduct("Microsoft ASP.NET MVC")]
#elif ASPNETWEBPAGES

3> Change the Web.config file in the root directory

<compilation debug="true" targetFramework="4.0">
    <assemblies>
        <add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.Helpers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.Mvc, Version=4.0.0.1, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <!--<add assembly="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null" />-->
        <add assembly="System.Web.WebPages, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>

<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <dependentAssembly>
        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0" newVersion="2.0.0.0" />
    </dependentAssembly>
    <dependentAssembly>
        <!--<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />-->
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31BF3856AD364E35" />
        <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="4.0.0.1" />
    </dependentAssembly>
    <dependentAssembly>
        <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0" newVersion="2.0.0.0" />
    </dependentAssembly>
</assemblyBinding>

4> Change the Web.config file in the View directory

<system.web.webPages.razor>
<!--<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />-->
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=4.0.0.1, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<pages pageBaseType="System.Web.Mvc.WebViewPage">
  <namespaces>
    <add namespace="System.Web.Mvc" />
    <add namespace="System.Web.Mvc.Ajax" />
    <add namespace="System.Web.Mvc.Html" />
    <add namespace="System.Web.Routing" />
    <add namespace="DevTrends.MvcDonutCaching" />
  </namespaces>

<!--<pages validateRequest="false" pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
   <controls>
     <add assembly="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" />
   </controls>
</pages>-->
<pages validateRequest="false" pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=4.0.0.1, Culture=neutral, PublicKeyToken=31BF3856AD364E35" pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=4.0.0.1, Culture=neutral, PublicKeyToken=31BF3856AD364E35" userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=4.0.0.1, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
    <controls>
        <add assembly="System.Web.Mvc, Version=4.0.0.1, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" />
    </controls>
</pages>

5> Restart the Asp.net Development Server. Ok, enjoy the source code! Thank @Rick.Anderson-at-Microsoft.com for the comment.

debug image

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

2 Comments

I needed to add the modified libs to the gac (so I didnt have to update every assembly in the app's folder) and a binding redirect for System.Web.Razor to the latest version as well otherwise Views wouldn't render, so something like: <dependentAssembly> <assemblyIdentity name="System.Web.Razor" publicKeyToken="31bf3856ad364e35" /> <bindingRedirect oldVersion="1.0.0.0-2.1.0.0" newVersion="2.1.0.0" /> </dependentAssembly>
Published a more detailed post in my blog - vijayt.com/Post/…
0

An easier way that doesn't involve modifying MVC source code is found in the MVC source code documentation. Download their attached SkipStrongNames attachment, unzip it, and run it from a UAC elevated command prompt. If you are pulling the latest version down from GIT (git clone https://git01.codeplex.com/aspnetwebstack.git), you may need to change references in the views/web.config file to use 3.0.0.0 instead of 2.0.0.0 and 5.0.0.0 instead of 4.0.0.0.

1 Comment

Im not sure this works as is? The steps below via sn.exe take care of the strong name issue to ignore for token: 31BF3856AD364E35. in addition by default the 4.0.0.0 assemblies are in the gac which is the first place checks, so keeping at 4.0.0.0 would use the gac version, and 5.0.0.0 would fail as that version doesn't exist - unless i'm missing something here? Have you got this to work?
0

I am able to use SkipStrongNames utility to debug ASP.NET MVC 4 source code with some project setting changes. Please see my blog for detailed steps at Debug ASP.NET MVC 4 Source Code

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.