Announcing NuPack, ASP.NET MVC 3 Beta, and WebMatrix Beta 2
I’m excited to announce the beta release of several projects today.
Two of these releases - ASP.NET MVC 3 Beta and WebMatrix Beta 2 - are evolutions of projects we first previewed this summer. The third – NuPack - is a new project that I’m particularly excited about.
NuPack – Open Source Package Manager for .NET
NuPack is a free open source package manager that makes it easy for you to find, install, and use .NET libraries in your projects. It works with all .NET project types (including, but not limited to, both ASP.NET Web Forms and ASP.NET MVC).
NuPack enables developers who maintain open source projects (for example, projects like Moq, NHibernate, Ninject, StructureMap, NUnit, Windsor, RhinoMocks, Elmah, etc) to package up their libraries and register them with an online gallery/catalog that is searchable. The client-side NuPack tools – which include full Visual Studio integration – make it trivial for any .NET developer who wants to use one of these libraries to easily find and install it within the project they are working on.
NuPack handles dependency management between libraries (for example: library1 depends on library2). It also makes it easy to update (and optionally remove) libraries from your projects later. It supports updating web.config files (if a package needs configuration settings). It also allows packages to add PowerShell scripts to a project (for example: scaffold commands). Importantly, NuPack is transparent and clean – and does not install anything at the system level. Instead it is focused on making it easy to manage libraries you use with your projects.
NuPack is itself an open-source project. The Outercurve Foundation (formerly CodePlex Foundation) today announced the acceptance of the NuPack project to the ASP.NET Open Source Gallery. Developers - both inside and outside Microsoft – will contribute features, bug fixes and patches to NuPack.
Our goal with NuPack is to make it as simple as possible to integrate open source libraries within .NET projects. It will be supported in all versions of Visual Studio. You can start using the first developer preview of it today.
A Simple NuPack Scenario – Enabling ELMAH
As a simple example to show off what NuPack enables – let’s assume we are working on a brand new ASP.NET application and want to use the popular open-source “ELMAH” library to log and report errors with our site. To install ELMAH today, you’d need to manually download it, unzip it, add a reference to your project, make sure you have source control bindings for the library setup correctly, and update the web.config file of your application to include the Elmah HttpModule entries. All doable – but a little tedious.
With NuPack installed, you can simply open the new “Package Manager Console” that NuPack enables inside VS and type “Add-Package elmah” within it:
Typing "Add-Package elmah” causes NuPack to check an online feed to locate the Elmah library, download it, add a reference of it to your current project, and automatically add the appropriate Elmah registration entries within your application’s web.config file:
And now we have Elmah setup and installed for our project, and error report logging enabled. No additional manual steps required to make it work.
Learn More About NuPack
Check out the following links to learn more about NuPack and some of the many scenarios it enables:
- Scott Hanselman’s NuPack Tutorial
- Phil Haack’s NuPack Post
- Bill Simser’s Post on NuPack (he is a non-Microsoft dev working on it)
- Rob Reynold’s “Evolution of Package Management on .NET” Post (Rob is one of the leaders of the Nu project and is on the NuPack team)
- David Ebbo’s NuPack Post
- Documentation and tutorials on nupack.codeplex.com
.NET and Open Source
We think NuPack will be a fundamental component of the .NET stack going forward. It will encourage more .NET developers to use open-source libraries. Having a standard package manager integrated into millions of copies of Visual Studio will hopefully also encourage the creation of more open source projects with .NET.
ASP.NET MVC 3 Beta
Today we are also shipping a Beta Release of ASP.NET MVC 3. This release is a significant update of the ASP.NET MVC 3 Preview we shipped two months ago, and includes a bunch of great feature improvements.
In addition to the ASP.NET MVC 3 features introduced with the first preview, today’s beta includes:
-
Razor Enhancements: ASP.NET MVC 3 supports the new Razor view-engine option. In addition to the functionality enabled with the ASP.NET MVC 3 Preview, today’s Beta adds a bunch of additional capabilities: Cleaner MVC integration – including the ability to use a new @model syntax to more cleanly specify the type being passed to the view. A new @helper syntax for declaring re-usable HTML helpers (really slick). A new @* *@ comment syntax. The ability to specify defaults (like layoutpage) once for the entire site - keeping your views DRY. Support for using both C# and VB flavors of Razor.
-
New View Helpers: New view helper methods are now supported. This includes a new Chart() helper method for dynamically creating charts (same features as the <asp:chart> control in ASP.NET 4 – except now using view helper methods), as well as a new WebGrid() helper method that can be used to create data-grid style UI (including paging and sorting).
-
Unobtrusive JavaScript and HTML 5: The AJAX and Validation helpers in ASP.NET MVC now both use an unobtrusive JavaScript approach by default. Unobtrusive JavaScript avoid injecting inline JavaScript into HTML, and instead enables cleaner separation of behavior using the new HTML 5 data- convention (which conveniently works on older browsers as well). This makes your HTML smaller and cleaner, and makes it easier to optionally swap out or customize JS libraries. The Validation helpers in ASP.NET MVC 3 also now use the jQueryValidate plugin by default.
-
Dependency Injection: The initial ASP.NET MVC 3 Preview added better support for Dependency Injection (DI) with Controllers, Views and Action Filters. Today’s Beta extends this with better dependency injection support for Model Binders, Model Validation Providers, Model Metadata Providers, and Value Providers. It also supports a new IDependencyResolver interface that makes it easier to integrate Dependency Injection Frameworks.
-
NuPack Integration: ASP.NET MVC 3 automatically installs and enables NuPack as part of its setup. This makes it trivial to take advantage of NuPack to find and add lots of MVC extensions and libraries to your projects.
-
Other Goodness: The initial ASP.NET MVC 3 Preview added lots of additional helpers and classes to make everyday coding better. Today’s beta includes a bunch of additional improvements: more granular XSS HTML input validation, HTML helper improvements to support HTML 5, Crypto helpers for salting and hashing passwords, easier Email APIs, improved “New Project” dialog, etc.
The ASP.NET MVC 3 beta supports “go-live” deployments – which means the license does not restrict you from building and deploying production applications with it.
Learn more about ASP.NET MVC 3
Check out the below links to learn more about the ASP.NET MVC 3 Beta:
- Phil Haack’s Overview Post
- Brad Wilson’s Unobtrusive JavaScript Post
- Brad Wilson’s Unobtrusive JavaScript Validation Post
- Brad Wilson’s Dependency Injection Series (Model Validation, Model MetaData, Value Providers, Model Binders, Controller Activator, View Page Activator)
Download
Click here to download and install the ASP.NET MVC 3 Beta using the Microsoft Web Platform Installer.
Alternatively you can download and install the ASP.NET MVC 3 Beta using a standalone installer here (note: for today’s beta you need to first install the AspNetWebPages.msi link from that page and then the AspNetMVC3Setup.exe file).
WebMatrix Beta 2
Today we are also shipping WebMatrix Beta 2. This release is an update of the WebMatrix Beta 1 preview we shipped this summer, and includes a number of great feature improvements.
In addition to the WebMatrix features introduced with the first beta, today’s Beta 2 release includes:
-
Web Page Enhancements: WebMatrix supports building standalone ASP.NET Web Pages using the new Razor syntax. It includes the same syntax improvements (@helper, @* comment *@, etc) that I mentioned above with ASP.NET MVC 3. It also now supports building pages using both VB and C#.
-
Improved Templates: WebMatrix includes template projects for common scenarios. The template projects now use HTML 5 and CSS 3 (and also work with downlevel browsers). A new Wishlist project template has been added with Beta 2.
-
NuPack Integration: WebMatrix provides NuPack integration and supports a web-based admin experience for installing libraries to an application you are working on.
-
Toolkit Support: We are delivering a toolkit (that can be installed via NuPack) that provides convenient helpers that can be used within ASP.NET applications. This includes helpers for Analytics, Facebook, GamerCard, Gravatar, LinkShare, Captcha, Twitter and Video scenarios.
Download
Click here to download and install WebMatrix Beta 2.
Summary
Today’s releases further evolve and enhance the Microsoft Web Stack. All of the above capabilities work with .NET 4 and VS 2010, and do not modify any existing files that ship with it (they are all additive and safe to install on your machine).
I’ll be blogging more details about some of the above improvements in the weeks ahead.
Hope this helps,
Scott