Thursday May 21, 2009 at 03:41 AM | Posted by: danielj | Category: ASP.NET MVC

As you are aware, complete source code for the ASP.NET MVC Framework is available on CodePlex. If you have not already done so, please download the source from CodePlex. With the source and a little setup, you can debug right into the framework's source. This is often very useful when troubleshooting pesky issues.

In order to setup debugging please follow the procedure below.

  1. Remove your project's reference to system.web.mvc.
  2. Add the project System.Web.Mvc.csproj, available under MVC\src\SystemWebMvc (relative to the folder where you unzipped the source code), to your solution.
  3. Add a reference to the project you just added to your main ASP.NET MVC application project (as a project reference). This reference replaces your original system.web.mvc assembly reference.
  4. Uncomment the reference to System.Web.Mvc in your web.config file as shown below.

 

<compilation debug="true">

<assemblies>

<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

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

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

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

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

<add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

<add assembly="System.Data.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

</assemblies>

</compilation>
  • Locate the web.config file available under the Views folder and replace all PublicKeyToken instances under the pages node with null (original value will be 31BF3856AD364E35) as shown below.
<pages

validateRequest="false"

pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"

pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"

userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null">

<controls>

<add assembly="System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" namespace="System.Web.Mvc" tagPrefix="mvc" />

</controls>

</pages>

You should now be able to debug into the ASP.NET MVC source code. Please do remember to reverse these steps when deploying your project.

ASP.NET Futures Assembly

If you are using the ASP.NET futures assembly, you can add a reference to this assembly also and debug without any additional changes. The source code for the futures assembly is installed under MVC\src\MvcFutures along with the ASP.NET MVC source code.

Comments

7/22/2010 3:12:16 PM #

Thanx once more for a pleasant site.

Justine Waggy | Reply

7/23/2010 12:12:40 PM #

I enjoy seeing websites that understand about my search. I truly loved your site. I hope I find new article in this site. Thanks

gerasa | Reply

7/26/2010 5:00:11 AM #

Valuable site, where did u come up with the information on this posting? I am happy I discovered it though, ill be checking back soon to see what added content u have.

Socorro Boehman | Reply

7/27/2010 3:28:55 AM #

One has to assume by it earlier than coming to a conclusion on about it,stunning web site I like the header.

Dorothy Desousa | Reply

7/27/2010 3:29:02 AM #

Good day, good day. Nice post. You may have gained a brand new reader. Pls stick with it and I look forward to extra of your excellent blog posts. Greets, Jessica.

Lessie Leeber | Reply

7/27/2010 5:44:38 PM #

I came here through a search in Google and your site gave me just the right information

google sniper by george brown | Reply

Add comment



biuquote
  • Comment
  • Preview
Loading

Tag cloud