ASP.NET MVC 3 and NuGet 1.0 Released (Including Source Code!)

The changing of the year is a time of celebration as people reflect thoughtfully on the past year and grow excited with anticipation for what’s to come in the year ahead.

Today, there’s one less thing to anticipate as we announce the final release of ASP.NET MVC 3 and NuGet 1.0!

double-rainbow
Oh yeah, this never gets old.

Install it via Web Platform Installer or download the installer directly to run it yourself.

Here are a few helpful resources for learning more about this release:

Those links will provide more details about what’s new in ASP.NET MVC 3, but I’ll give a quick bullet list of some of the deliciousness you have to look forward to. Again, visit the links above for full details.

  • Razor view engine which provides a very streamlined syntax for writing clean and concise views.
  • Improved support for Dependency Injection
  • Global Action Filters
  • jQuery based Unobtrusive Ajax and Client Validation.
  • ViewBag property for dynamic access to ViewData.
  • Support for view engine selection in the New Project and Add View dialog
  • And much more!

For those of you wishing to upgrade an ASP.NET MVC 2 application to ASP.NET MVC 3, check out Marcin Dobosz’s post about our ASP.NET MVC 3 Projct upgrader tool. The tool itself can be found on our CodePlex website.

NuGet 1.0 RTM

Also included in this release is the 1.0 release of NuGet. I’ll let you in on a little secret though, if you upgraded NuGet via the Visual Studio Extension Gallery, then you’ve been running the 1.0 release for a little while now.

If you already have an older version of NuGet installed, the ASP.NET MVC 3 installer cannot upgrade it. Instead launch the VS Extension manager (within Visual Studio go to the Tools menu and select Extension Manager) and click on the Updates tab.

Just recently we announced the Beta release of our NuGet Gallery. Opening the door to the gallery will make it very easy to publish packages, so what are you waiting for!?

At this point I’m obligated to point out that everything about NuGet is open source and we’re always looking for contributors. If you’re interested in contributing, but are finding impediments to it, let us know what we can improve to make it easier to get involved. Here’s the full list of OSS projects that make up the NuGet client and the server piece:

Show Me The Open Source Code!

As we did with ASP.NET MVC 1.0 and ASP.NET MVC 2, the source for the ASP.NET MVC 3 assembly is being released under the OSI certified Ms-PL license. The Ms-PL licensed source code is available as a zip file at the download center.

If you’d like to see the source code for ASP.NET Web Pages and our MVC Futures project, we posted that on CodePlex.com too.

What’s Next?

So what’s next? Well you can probably count as well as I can, so it’s time to start getting planning for ASP.NET MVC 4 and NuGet 2.0 in full gear. Though this time around, with NuGet now available, we have the means to easily distribute a lot of smaller releases throughout the year as packages, with the idea that many of these may make their way back into the core product. I’m sure you’ll see a lot of experimentation in that regard.

What others have said

Requesting Gravatar... MrDustpan Jan 13, 2011 1:41 AM
# re: ASP.NET MVC 3 and NuGet 1.0 Released (Including Source Code!)
Wow is that a full-on double rainbow, all the way?
Requesting Gravatar... Dmitry Podrezov Jan 13, 2011 1:54 AM
# re: ASP.NET MVC 3 and NuGet 1.0 Released (Including Source Code!)
Thank you so much for all the work. Hope you have real fun celebrating awsome release.
Requesting Gravatar... Quentin Jan 13, 2011 1:58 AM
# re: ASP.NET MVC 3 and NuGet 1.0 Released (Including Source Code!)
Awesome. I am excited to be a developer working on ASP.Net web sites. The .Net landscape has really become a fun space to work in. Keep up the great work!!
Requesting Gravatar... Chad Moran Jan 13, 2011 1:59 AM
# re: ASP.NET MVC 3 and NuGet 1.0 Released (Including Source Code!)
Thank you Phil, Scott, Scott and co! Don't know where I'd be without MVC. :)
Requesting Gravatar... Richard Turner Jan 13, 2011 2:04 AM
# re: ASP.NET MVC 3 and NuGet 1.0 Released (Including Source Code!)
Congratulations on wrapping this release up. MVC3 & Razor are possibly the most anticipated release of MVC ever and elevate Microsof't web platform way beyond almost every other web platform available.

Great product from a great team :)
Requesting Gravatar... mob Jan 13, 2011 2:07 AM
# re: ASP.NET MVC 3 and NuGet 1.0 Released (Including Source Code!)
Great work. BTW, when are we going to see an installer-less distro of MVC? A zip distro would be nice for xcopy deployment strategies. Obviously the zip would only include the MVC bits and not the VS tools.
Requesting Gravatar... Richard Garside Jan 13, 2011 2:19 AM
# Mega release day
MVC 3, NuGet 1.0, IIS Express, Web matrix and Orchard 1.0 all released today. You Microsoft Guys have been busy. I know what I'll be doing this weekend.

Thanks for all the hard work. Been working with the RC versions for a while and it's been great.
Requesting Gravatar... Aliaksei Jan 13, 2011 2:24 AM
# re: ASP.NET MVC 3 and NuGet 1.0 Released (Including Source Code!)
Phil, unfortunately the WebPages codeplex links doesn't work :(
Requesting Gravatar... Gideon Israel Jan 13, 2011 2:39 AM
# re: ASP.NET MVC 3 and NuGet 1.0 Released (Including Source Code!)
I'm one whole day late! First time Ive been so anxious for an RTM release (Since I've never even tried an RC before =(

You guys have done really amazing things with asp.net mvc 3...

Downloading it now!..
Requesting Gravatar... Igorbek Jan 13, 2011 3:12 AM
# re: ASP.NET MVC 3 and NuGet 1.0 Released (Including Source Code!)
Hello!

I found some unexpected behavior when generating URL for actions: UriHelper.Action (or others) implictly takes route values from current context.

For example:

Routes:

routes.MapRoute("User", "{userId}/{controller}/{action}/{id}",
new { controller = "Home", action = "Index", id = UrlParameter.Optional }, new { userId = "^[1-9]\\d*$" });

routes.MapRoute("Default", "{controller}/{action}/{id}", new { controller = "Home", action = "Index", id = UrlParameter.Optional});

Controller:

public class HomeController : Controller
{
public ActionResult Index() { return View(); }
public ActionResult Test(int userId) { return View("Index"); }
}

View 'Index':

Expected: "/", Actual: "@Url.Action("Index", "Home")"
Expected: "/10/Home/Test", Actual: "@Url.Action("Test", "Home", new { userId = 10 })"

Result of '/':

Expected: "/", Actual: "/"
Expected: "/10/Home/Test", Actual: "/10/Home/Test"

All right!

Result of '/10/Home/Test':

Expected: "/", Actual: "/10"
Expected: "/10/Home/Test", Actual: "/10/Home/Test"

Why? The route value 'userId' set implictly from current route values into generated route link!

Can you help me?
Requesting Gravatar... Aliaksei Jan 13, 2011 3:29 AM
# re: ASP.NET MVC 3 and NuGet 1.0 Released (Including Source Code!)
I stand corrected: the link works now :)
Requesting Gravatar... Raf Jan 13, 2011 5:03 AM
# re: ASP.NET MVC 3 and NuGet 1.0 Released (Including Source Code!)
I would like to start learning asp.net mvc 3 (I'm windows programmer with few years experience). Is it a good idea to start reading a book about asp.net mvc 2 and then learn all changes from blogs/tutorials? or should I wait for a book about mvc 3? Thanks for answer.
Requesting Gravatar... Esmaltes Jan 13, 2011 6:14 AM
# re: ASP.NET MVC 3 and NuGet 1.0 Released (Including Source Code!)
Very good news ! I will start to convert my old sites now
Requesting Gravatar... Phil Jan 13, 2011 7:37 AM
# re: ASP.NET MVC 3 and NuGet 1.0 Released (Including Source Code!)
Hi Phil - I get a fatal error installation message on Windows 7 32 bit. Any known issues?
Requesting Gravatar... Piers Lawson Jan 13, 2011 7:55 AM
# re: ASP.NET MVC 3 and NuGet 1.0 Released (Including Source Code!)
Great news, I'll be looking into how it helps with my RESTful web services.
Requesting Gravatar... Matthew Hintzen Jan 13, 2011 11:12 AM
# re: ASP.NET MVC 3 and NuGet 1.0 Released (Including Source Code!)
Compile blows up if you have the T4MVC.tt in your upgraded solution. while trying to compile the T4MVC.cs file you get the follow error:

Error 12 The type 'System.Web.WebPages.Razor.WebRazorHostFactory' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Requesting Gravatar... Matthew Hintzen Jan 13, 2011 12:32 PM
# re: ASP.NET MVC 3 and NuGet 1.0 Released (Including Source Code!)
For the record on the MV3 not working with T4MVC, here is the work around: all you have to do is add a reference to the Razor dll. You will need to browse in the add reference dialog to find it. You will find it at "%ProgramFiles%\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\Assemblies" add a reference to the System.Web.WebPages.Razor.dll to your project and things compile fine

(Note on x64 OS %ProgramFiles% in this case denotes Program Files (x86)
Requesting Gravatar... shiju varghese Jan 13, 2011 12:32 PM
# re: ASP.NET MVC 3 and NuGet 1.0 Released (Including Source Code!)
Congrats for the awesome ASP.NET MVC 3
Requesting Gravatar... Bats Ihor Jan 13, 2011 4:30 PM
# re: ASP.NET MVC 3 and NuGet 1.0 Released (Including Source Code!)
My congratulations! Very nice job. I am enjoying it!
Requesting Gravatar... Fritz Mack Jan 13, 2011 5:01 PM
# re: ASP.NET MVC 3 and NuGet 1.0 Released (Including Source Code!)
Hi Phil,

after installing RTM I get this error. I reinstalled the software but with no success :-(

The composition produced a single composition error. The root cause is
provided below. Review the CompositionException.Errors property for
more detailed information.

1) The element 'metadata' in namespace
'schemas.microsoft.com/packaging/2010/07/nuspec.xsd' has
invalid child element 'created' in namespace
'schemas.microsoft.com/packaging/2010/07/nuspec.xsd'. List of
possible elements expected: 'iconUrl, dependencies, licenseUrl,
projectUrl, title, tags, summary, owners' in namespace
'schemas.microsoft.com/packaging/2010/07/nuspec.xsd'.

Resulting in: An exception occurred while trying to create an instance of
type 'NuGet.Dialog.PackageManagerUI.PackageManagerWindow'.

Resulting in: Cannot activate part
'NuGet.Dialog.PackageManagerUI.PackageManagerWindow'.
Element: NuGet.Dialog.PackageManagerUI.PackageManagerWindow
--> NuGet.Dialog.PackageManagerUI.PackageManagerWindow -->
AssemblyCatalog (Assembly="NuGet.Dialog, Version=1.0.11220.104,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")

Resulting in: Cannot get export
'NuGet.Dialog.PackageManagerUI.PackageManagerWindow
(ContractName="NuGet.Dialog.PackageManagerUI.PackageManagerWi
ndow")' from part
'NuGet.Dialog.PackageManagerUI.PackageManagerWindow'.
Element: NuGet.Dialog.PackageManagerUI.PackageManagerWindow
(ContractName="NuGet.Dialog.PackageManagerUI.PackageManagerWi
ndow") --> NuGet.Dialog.PackageManagerUI.PackageManagerWindow
--> AssemblyCatalog (Assembly="NuGet.Dialog,
Version=1.0.11220.104, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a")
Requesting Gravatar... Fujiy Jan 13, 2011 6:08 PM
# re: ASP.NET MVC 3 and NuGet 1.0 Released (Including Source Code!)
Phil, CachedDataAnnotationsMetadataProvider class shouldn´t be at MvcFutures? Its what release notes say.
Requesting Gravatar... Anton Jan 13, 2011 10:29 PM
# re: ASP.NET MVC 3 and NuGet 1.0 Released (Including Source Code!)
Out of interest why does it take so long to install asp.net mvc (any version)? I'm referring to the actual installation after the download has completed?
Requesting Gravatar... Bob Jan 14, 2011 1:30 AM
# re: ASP.NET MVC 3 and NuGet 1.0 Released (Including Source Code!)
I take the rainbow to mean that asp.net mvc is "inclusive", and is for everyone including apple employees...
Requesting Gravatar... ebb Jan 14, 2011 4:19 AM
# re: ASP.NET MVC 3 and NuGet 1.0 Released (Including Source Code!)
"Improved support for Dependency Injection"

Is there any examples up that shows how to use DI with MVC 3 RTM? - The post you refer to is outdated and none of the interfaces/classes is in the System.Web.MVC assembly?
Requesting Gravatar... haacked Jan 14, 2011 4:37 AM
# re: ASP.NET MVC 3 and NuGet 1.0 Released (Including Source Code!)
@Fritz Check our Known Issues and start a discussion if you don't find anything.
Requesting Gravatar... Developer Seer Jan 14, 2011 8:58 AM
# re: ASP.NET MVC 3 and NuGet 1.0 Released (Including Source Code!)
Awesome, Just installed it and I'm going to test it right now!

Just waiting for HanselScaffolding 1.0!

Congratz Phill
Requesting Gravatar... Rodrigo Caballero Jan 14, 2011 12:17 PM
# re: ASP.NET MVC 3 and NuGet 1.0 Released (Including Source Code!)
Hi Phill,

I have the RC 2 installed. Should I uninstall this release before the RTM?

thanks a lot
@rodrigo
Requesting Gravatar... haacked Jan 14, 2011 2:40 PM
# re: ASP.NET MVC 3 and NuGet 1.0 Released (Including Source Code!)
@Rodrigo, no need to uninstall.
@Developer, Check out Steve Sannderson's MvcScaffolding package!
Requesting Gravatar... Martin Jan 15, 2011 12:19 AM
# re: ASP.NET MVC 3 and NuGet 1.0 Released (Including Source Code!)
This is great news. But I find your release notes a bit confusing.

"Razor views do not have IntelliSense support nor syntax highlighting. It is anticipated that support for Razor syntax in Visual Studio will be included as part of a later release."

Is this from an old version ? Because intellisense and syntax highlighting works fine on my computer.

Also you mention that you need to include
<add key="enableSimpleMembership" value="false" />
<add key="autoFormsAuthentication" value="false" />
In the web.config, but these settings are not included when creating a new MVC 3 project. So are they really needed or did you forget to remove it ?

Requesting Gravatar... Matthew Hintzen Jan 15, 2011 3:44 AM
# re: ASP.NET MVC 3 and NuGet 1.0 Released (Including Source Code!)
More information on the T4MVC.tt error during build: Error 12 The type 'System.Web.WebPages.Razor.WebRazorHostFactory' is defined in an assembly that is not referenced.

This seems to only show up when you have set <MvcBuildViews>true</MvcBuildViews> in the project file. Either set the value to false (or delete it) from the csproj file or add a reference to the .dll (depending on which work around seems "correct" to you)
Requesting Gravatar... dotnetstep Jan 15, 2011 8:37 AM
# re: ASP.NET MVC 3 and NuGet 1.0 Released (Including Source Code!)
Hello All,

Is that MVC 3 support conditional validation ?
Is that MVC 3 support validation group ?

Can i disable and enable validation for individual control from javascript ?

Thanks.
Requesting Gravatar... stuhin Jan 15, 2011 8:57 AM
# re: ASP.NET MVC 3 and NuGet 1.0 Released (Including Source Code!)
Hi Phil,
method RedirectToAction
MVC3RC:
routes.MapRoute(
"Default",
"{controller}/{action}/{id}/{id2}/{id3}",
new
{
controller = "Home",
action = "Index",
id = UrlParameter.Optional,
id2 = UrlParameter.Optional,
id3 = UrlParameter.Optional
});
MVC3RTM need to paint the full, otherwise RedirectToAction("Action") bag:
routes.MapRoute(
"Default3",
"{controller}/{action}/{id}/{id2}/{id3}",
new
{
controller = "Home",
action = "Index",
id = UrlParameter.Optional,
id2 = UrlParameter.Optional,
id3 = UrlParameter.Optional
});
routes.MapRoute(
"Default2",
"{controller}/{action}/{id}/{id2}",
new
{
controller = "Home",
action = "Index",
id = UrlParameter.Optional,
id2 = UrlParameter.Optional
});
routes.MapRoute(
"Default",
"{controller}/{action}/{id}",
new
{
controller = "Home",
action = "Index",
id = UrlParameter.Optional
});

UrlParameter.Optional - optional?
regards
stuhin
Requesting Gravatar... Janos Jan 16, 2011 4:14 AM
# re: ASP.NET MVC 3 and NuGet 1.0 Released (Including Source Code!)
Hi Phil,
Do you know if MVC3 debug symbols are available on MS Symbol server?
I am trying to step into the source following this article weblogs.asp.net/..., but I managed to make it work only with MVC2 but not with MVC3.
I suppose the debug symbols are not yet available on the server, because if I check FailedLoads folder in SymbolCache I can see System.Web.Mvc_v4.0_3.0.0.0 file containing a "PDB Not Found" text.
Thanks
Janos
Requesting Gravatar... Henning Anderssen Jan 16, 2011 11:27 PM
# re: ASP.NET MVC 3 and NuGet 1.0 Released (Including Source Code!)
Great news.

What about the Futures library? I can't see any released binaries of it.
I've been looking into creating some Spark templates. Do you have any information as to how I can do that easily?

Thanks
Requesting Gravatar... counsellorben Jan 17, 2011 1:08 AM
# re: ASP.NET MVC 3 and NuGet 1.0 Released (Including Source Code!)
@dotnetstep,

1. Conditional validation. Yes, you can create your own client and server side conditional validators.

2. Validation groups. Here is a link to a great tip to create "validation groups" using the jquery.validate library which powers MVC 3 unobtrusive validation: http://encosia.com/2009/11/24/asp-net-webforms-validation-groups-with-jquery-validation/

counsellorben
Requesting Gravatar... Malcolm Jan 17, 2011 8:43 AM
# re: ASP.NET MVC 3 and NuGet 1.0 Released (Including Source Code!)
Hi Phil,

One question has always been on my mind. Why release the code as open source? Can members of the community updates patches and commit the code to a central repository?
Requesting Gravatar... Todd Feb 02, 2011 4:46 AM
# re: ASP.NET MVC 3 and NuGet 1.0 Released (Including Source Code!)
Think I found a bug. There is apparently a known issue when you use the [Authorize] attribute on an action method or class, it redirects to "Account/Login" instead of deferring to config setting in web.config (see Sean Paul's comments @ haacked.com/.../asp-net-mvc-3-beta-released.aspx). The solution was to add <add key="AutoFormsAuthentication" value="false" /> to the <appSettings> of web.config. But that didn't work for me.

To recreate: Make new MVC website (with all default "home", "about" template stuff in there). Set [Authorize] attrib to Home controller class. Move the _ViewStart.cshtml to the root of the app (this is to have all Areas use the same layout page - instead of just the default/root area). Boom. Any other workarounds?
Requesting Gravatar... hilton smith Feb 20, 2011 6:11 PM
# re: ASP.NET MVC 3 and NuGet 1.0 Released (Including Source Code!)
Hey phil, loving mvc3 and all that jazz except for the "Add View" dialog and its strongly typed dropdown.

As of this morning the strongly typed view dropdown lists every single class from every single one of my dependencies EXCEPT for the types from my actual web project.

I've cleaned, rebuilt, rebooted, searched stackoverflow and am pretty close to slaughtering a goat to sacrifice to the Gods of Add View Dialogs in the vain hope that appeasing them will bring back my classes and allow me to quickly add views instead of making me type them out myself.

Is there any place I can go to find out just how that dropdown is populated and what I need to delete in order for it to be rebuilt? The goat hopes there is....
Requesting Gravatar... Sven Feb 22, 2011 7:18 PM
# re: ASP.NET MVC 3 and NuGet 1.0 Released (Including Source Code!)
Regarding the above question about whether MVC 3 supports conditional validation, it was above answered by "counsellorben Jan 17, 2011 9:08 AM" with the words "Yes, you can create your own client and server side conditional validators.".
My follow-up-question is then if you can define the validation logic once (into some kind of metadata validation model which can be used for geneating the javascript code) or you still need to duplicate it manually in C# code and in JavaScript code ?
If so, can somebody provide a link to a code example ?
(for the readers of this blog that is also interested in this question can also watch out the new thread I created today at stackoverflow.com/...
)

Requesting Gravatar... Ramil Akhmetov Mar 02, 2011 1:23 PM
# re: ASP.NET MVC 3 and NuGet 1.0 Released (Including Source Code!)
Thanks for this release!
Requesting Gravatar... haacked Mar 04, 2011 12:25 PM
# re: ASP.NET MVC 3 and NuGet 1.0 Released (Including Source Code!)
@Hilton we look for all public types in the current project and in referenced assemblies. We filter out types in certain System and Microsoft namespaces, etc.
Requesting Gravatar... simon horridge May 16, 2011 6:03 PM
# re: ASP.NET MVC 3 and NuGet 1.0 Released (Including Source Code!)
for a fix to ASP.NET MVC 3 Tools Update Setup fails with fatal error (0x80070643) go to:

greuel.name/...

What do you have to say?

(will show your gravatar)
Please add 6 and 2 and type the answer here: