ASP.NET MVC Source Code Now Available

Last month I blogged about our ASP.NET MVC Roadmap.  Two weeks ago we shipped the ASP.NET Preview 2 Release.  Phil Haack from the ASP.NET team published a good blog post about the release here.  Scott Hanselman has created a bunch of great ASP.NET MVC tutorial videos that you can watch to learn more about it here.

One of the things I mentioned in my MVC roadmap post was that we would be publishing the source code for the ASP.NET MVC Framework, and enable it to be easily built, debugged, and patched (so that you can work around any bugs you encounter without having to wait for the next preview refresh release).

Today we opened up a new ASP.NET CodePlex project that we'll be using to share buildable source for multiple upcoming ASP.NET releases.  You can now directly download buildable source and project files for the ASP.NET MVC Preview 2 release here.

Building the ASP.NET MVC Framework

You can download a .zip file containing the source code for the ASP.NET MVC Framework for the release page here.  When you extract the .zip file you can drill into its "MVC" sub-folder to find a VS 2008 solution file for the project: 

Double-clicking it will open the MVC project containing the MVC source within VS 2008:

When you do a build it will compile the project and output a System.Web.Mvc.dll assembly under a \bin directory at the top of the .zip directory.  You can then copy this assembly into a project or application and use it.

Note: the license doesn't enable you to redistribute your custom binary version of ASP.NET MVC (we want to avoid having multiple incompatible ASP.NET MVC versions floating around and colliding with each other).  But it does enable you to make fixes to the code, rebuild it, and avoid getting blocked by an interim bug you can't work around.

Next Steps

Our plans are to release regular drops of the source code going forward.  We'll release source updates every time we do official preview drops.  We will also release interim source refreshes in between the preview drops if you want to be able to track and build the source more frequently.

We are also hoping to ship our unit test suite for ASP.NET MVC in the future as well (right now we use an internal mocking framework within our tests, and we are still doing some work to refactor this dependency before shipping them as well).

Hope this helps,

Scott

Published Friday, March 21, 2008 7:33 AM by ScottGu
Filed under: , , ,

Comments

# re: ASP.NET MVC Source Code Now Available

Friday, March 21, 2008 11:09 AM by sean

Sweet.  Can't wait for mvc 1.0.  :-)

# re: ASP.NET MVC Source Code Now Available

Friday, March 21, 2008 11:14 AM by JohnR

Need tutorials with VS Express integration.

# re: ASP.NET MVC Source Code Now Available

Friday, March 21, 2008 11:33 AM by Joel Cochran

Great! Keep it up guys!

# re: ASP.NET MVC Source Code Now Available

Friday, March 21, 2008 11:33 AM by Piers

MVC is looking promising for our needs. Do you have any plans to introduce support for asynchronous processing?

# re: ASP.NET MVC Source Code Now Available

Friday, March 21, 2008 11:41 AM by Ben Mills

Scott, I know we're not going to nail you down on a release date,  but do you have kind of ball park month/quarter for us?

# re: ASP.NET MVC Source Code Now Available

Friday, March 21, 2008 11:44 AM by tgmdbm

woot. excellent.

Why did you not release the source for System.Web.Routing?

# re: ASP.NET MVC Source Code Now Available

Friday, March 21, 2008 12:30 PM by LTG

awesome, great.  Would this be possible for dynamic data or other "around the edges" technologies also?

thanks.

# re: ASP.NET MVC Source Code Now Available

Friday, March 21, 2008 1:06 PM by michaelh

Scott,

This is awesome. I love the move to transparency. I especially like how Microsoft is making unit tests available for both the MVC project and the Silverlight controls. I find that one challenge when people first approach unit tests, even if they understand and accept the concept, is translating theory into practice (at least my team and I did years ago). Making such a wealth of examples from MS should only enhance the unit test ecosystem in the entire .net stack.

Thanks!

# re: ASP.NET MVC Source Code Now Available

Friday, March 21, 2008 1:15 PM by Mike

This is great. As a .NET programmer I sometimes wonder if switching to an open source framework is a better choice for me and for the company I work for, and I am still seriously considering it. But I do like .NET and C# a lot, so the more source and general openness the better.

# re: ASP.NET MVC Source Code Now Available

Friday, March 21, 2008 1:21 PM by Dave Parslow

Thank you for releasing the source code! I am looking for regular drops of the source code - nightly builds (that is probably unlikely to happen)? Is your internal mocking framework any good?  Why not release that too ;-)

I had a question about why some of the tag builder classes such as HtmlExtensionUtility and TagBuilder are internal?  As I have built some of my own extensions it seems like I have to redo some of the effort that is built into these classes.

# re: ASP.NET MVC Source Code Now Available

Friday, March 21, 2008 1:51 PM by Kevin Dente

There's a lot of middle ground between "source available" and "can't ship a modified binary". Can we, say, blog code snippets of bug fixes that we find? Post entire source files with those fixes included? Some clarity about what we can and can't do would be helpful.

Or maybe it's all in the license, which I haven't actually read yet. :)

# re: ASP.NET MVC Source Code Now Available

Friday, March 21, 2008 1:57 PM by Jakob Andersen

Will the source code for the final release be available under the same terms(i.e. modifications allowed but no redistributing)?

# re: ASP.NET MVC Source Code Now Available

Friday, March 21, 2008 2:59 PM by Gauthier Segay

will you provide test cases?

# re: ASP.NET MVC Source Code Now Available

Friday, March 21, 2008 3:32 PM by John A Davis

No! No! I don't need it! Take it away! I have something else planned for this weekend! I have no use for this! It is not important to me!

# re: ASP.NET MVC Source Code Now Available

Friday, March 21, 2008 3:50 PM by Jeff

Where are the unit tests? I thought I heard Hanselman say at Mix that they had something like 90%+ code coverage in the unit tests for the framework. That'd be pretty awesome to see.

# re: ASP.NET MVC Source Code Now Available

Friday, March 21, 2008 4:28 PM by James W

Hi Scott,

This is great - Having a look through the project I noticed the dependent assemblies shipped with it - Are there any plans to expand availability to System.Web.Routing?

Regards

J

# re: ASP.NET MVC Source Code Now Available

Friday, March 21, 2008 6:27 PM by Jules

I'm really interested in ASP.MVC, but I cannot see much about this technology being used to implement Web Services, REST or SOPA/WCF based ?

What are MS Plans to support WCF with ASP.MVC ?

I note that RAILS only supports REST services by default.

Cheers

Jules

# re: ASP.NET MVC Source Code Now Available

Friday, March 21, 2008 7:24 PM by Andrei Rinea

Good work Scott!! Miguel (de Icaza) was right about you and your team "changing Microsoft from the inside out". ;)

# re: ASP.NET MVC Source Code Now Available

Friday, March 21, 2008 7:58 PM by Chris Hardy (ChrisNTR)

Cheers Scott,

This is what I call a birthday present!!

Great work again.

# re: ASP.NET MVC Source Code Now Available

Friday, March 21, 2008 9:57 PM by c.sokun

thanks, looking forward ASP.NET MVC 1.0 svn edition :)

# re: ASP.NET MVC Source Code Now Available

Sunday, March 23, 2008 1:41 PM by Dave Durose

Whoopdedo! Just what we need.  Another MVC framework.  What are you going to do to differentiate yourselves from the other MVC frameworks already out there?  I'm not seeing what all the buzz is about.

# re: ASP.NET MVC Source Code Now Available

Monday, March 24, 2008 2:56 AM by jwade

Hi Scott,

Step 1: Create a Site.Master template

To begin with we can create a new root master page file that we'll use to define the overall layout and structure for all pages on the site.  We'll name this file "Site.Master" and copy/paste the "outer chrome" HTML from the template we downloaded into it.  

We'll then add a <asp:contentplaceholder> into the content section in the middle where we'll fill in page specific content.  We'll name this <asp:contentplaceholder> control "MainContent":

I have downloaded the template. What do you mean by copy/patse the "outer chrome" ???

Regards, Johann

Regard

# re: ASP.NET MVC Source Code Now Available

Monday, March 24, 2008 6:26 AM by J2EE developper

Great News for DotNet to use the MVC DP. So, now for j2ee developper, they can work with both DotNet and J2ee with the same basic architecture.

Thanks for the news

# re: ASP.NET MVC Source Code Now Available

Monday, March 24, 2008 3:58 PM by Ken Fleming

I was hoping to see something I have been looking for for quite awhile.

Why is there no mention of a framework driven by meta data that loads User Controls based on user security settings.

Something like Panelbars on the left based on access being loaded from database or XML that loads user controls for TreeViews or just panel click items, with user controls being loaded on the right based on what the user clicked on the left.  Toolbars being build dynamically based on security settings.

All I ever see is MasterPage frameworks.  MasterPages still cause refreshes.  It would be nice to just load what needs to be loaded when it needs to be loaded and not a bunch of page refreshes.  Especially for a workbench type application (e.g. TFS WebAccess, OWA, etc.)

# re: ASP.NET MVC Source Code Now Available

Monday, March 24, 2008 10:29 PM by Harry Soetardjo

Pingback from Microsoft ASP.NET 3.5 MVC Source Code Now Available | Harry Soetardjo

# re: ASP.NET MVC Source Code Now Available

Tuesday, March 25, 2008 4:23 AM by ori

hi, I am a win 2000 pro user with vc6.0++ , do you have a demo project , for this kind of users?

actually most of the c/c++ developers I know use win 2000 pro with vc6.0++ , since it is light simple and most efficient.

the SDK platform supply a grate c++ substitusion for vb.NET and C#. is there somthing for ASP.NET as well???

# re: ASP.NET MVC Source Code Now Available

Tuesday, March 25, 2008 6:34 AM by raja

hi i love this article.

# re: ASP.NET MVC Source Code Now Available

Tuesday, March 25, 2008 6:35 AM by Rubens Farias

Scott,

About Web Client Software Factory (WCSF) MVP pattern and ASP.NET MVC: They will to merge/converge? Who will be incorporated to ASP.NET?

# re: ASP.NET MVC Source Code Now Available

Wednesday, March 26, 2008 9:11 AM by Deepak Chawla

Hi Scott,

 Looking in future should we be using Web Client Software factory which implements the MVC or this new idea on the block?

I would like to ask, In case in six months time someone else gets another good idea to "develop" (like I use the web client factory) can I have a conversion tool to migrate to MVC?

Regards

Deepak Chawla  

# re: ASP.NET MVC Source Code Now Available

Thursday, March 27, 2008 2:01 AM by Pradeep Kumar Mishra

Thanks for posting. I was looking forward to it.

# re: ASP.NET MVC Source Code Now Available

Thursday, March 27, 2008 3:58 AM by sdaemon

Gonna have to try this :). Thanks for the heads up

# re: ASP.NET MVC Source Code Now Available

Thursday, March 27, 2008 3:59 AM by sdaemon

Gonna have to look it up. Thanks for the head's up

# re: ASP.NET MVC Source Code Now Available

Thursday, March 27, 2008 10:05 AM by Randy

Great news. :)

Hi, Scott, I want to use asp.net MVC in our new project, but the version is Preview 2. When the final version be released, is there any critical risk for update?

Thanks

# re: ASP.NET MVC Source Code Now Available

Thursday, March 27, 2008 10:28 PM by jismith

[The Issue]

- Everything works fine on development computer.  Time to test it on a development server.  Server is Microsoft 2003, using iis 6.0.  Route handling is set to include “.mvc”.   “.mvc” is added in both the MIME types, and in the virtual directory configuration for the website.    The problem is that navigating to a page brings up the “page not found 404” error.

[Something Interesting]

- After checking a dozen times or so that the “.mvc” extension is added properly to iis.    If I change the routing to use “.ashx” instead of “.mvc” (because they use the same .dll), the routing works.

[The reason]

- After discovering that another extension that uses the same dll worked, I next had to figure out what was the difference between these two inside the metabase.xml.  This is what I discovered:

.ashx,C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll,1,GET,HEAD,POST,DEBUG

.mvc,C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG

- Note the difference between these lines.  .mvc has a “5” where .ashx has a “1”.  Changing the 5 to a 1 resolved the issue, and now I can use .mvc extensions in my routing.

[Conclusion]

- Would you know why and for what purpose these 5-1 flags are?  It appears iis doesn’t have any controls that deal with this flag.  You only deal with extension, path to dll, and the verbs.

- Was I correct in simply changing the xml instead of doing something from within iis.

- Does this fix deserve to be added to your blog?  If so, I’m happy to contribute!!

# re: ASP.NET MVC Source Code Now Available

Sunday, March 30, 2008 12:46 PM by Flavio Medeiros

Great article. I'm starting to learn and use this MVC framework with VS.