Well, I'm biting the bullet and I'm going to update my ASP.NET MVC Preview 5 project to the beta!
This Beta is an official release; as the previous "official" release was Preview 3. Lets see how it goes:
Step 1 - Install the Beta
This kind of goes without saying, but I this is a step by step guide.
Make sure all Instances of Visual Studio has been closed, Uninstall ASP.NET MVC Preview 5, then run the Beta Installer:
Start up Visual Studio and open your MVC project.
Step 2 - Update your assembly references
Update the following references in your web project to the new Beta dll's:
- System.Web.Abstractions.dll
- System.Web.Routing.dll
- System.Web.Mvc.dll
The default location for these are in: %ProgramFiles%\Microsoft ASP.NET\ASP.NET MVC Beta
Step 3 - Add web.config namespace and assembly
All the Html Helper extension methods have been moved to there own namespace: System.Web.Mvc.Html. You need to add this namespace to your web.config in order for the Html Helpers to show up in your views etc.
<namespaces>
<add namespace="System.Web.Mvc.Html"/>
<add namespace="Microsoft.Web.Mvc"/>
<add namespace="System.Web.Mvc"/>
<add namespace="System.Web.Routing"/>
<add namespace="System.Linq"/>
<add namespace="System.Collections.Generic"/>
</namespaces>
You'll also have to add this namespace if you use any of the input extensions in your own HtmlHelper extensions.
Because Mvc is now installed in the GAC I had to add the assembly to the compilation section:
<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.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"/>
<add assembly="System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</assemblies>
</compilation>
Step 4 - Change Html.Form...maybe!
In this release the HtmlHelper Form has been changed to BeginForm. This returns a MvcForm which is IDisposable so you can still wrap it up in a using statement or use the Html.EndForm().
The reason that I've said "maybe" is that most of my forms use the HtmlHelper Form from the Microsoft Mvc Futures assembly. This allows me to use the nice Generic form with Linq:
<% using (Html.Form<HomeController>( x => x.Index() )) { %>
I prefer to use this way as it does not involve entering the controller and action as strings.
If you want to use this way just reference the Microsoft.Web.Mvc.dll which was made available in Preview 5. They say (Microsoft aka Phil Haack) that the MvcFutures will be available on CodePlex, but I have not found the new version since the Beta. Something to remember to update...
UPDATE (17-10-2008): See Part 2 for info on the Microsoft Futures for Beta.
Don't forget to add this to your namespace section in your web.config as above.
If you use FormMethod anywhere in your code you may get an ambiguous reference now....so just reference the correct one (in my case the one in the Microsoft Futures). Same goes for the FormCollection.
Step 5 - Update any Custom View Engines
The IViewEngine now was a new method that you need to implement:
public void ReleaseView(ControllerContext controllerContext, IView view)
{
throw new NotImplementedException();
}
Also the ViewEngineResult constructor now need an IViewEngine as well as the IView:
return new ViewEngineResult(new WebFormView(viewPath), new WebFormViewEngine());
Step 5 - Build your project
Check to see if you get an other compilation errors.
I got one with an ambiguous reference to the FormMethod Enum in one of my partial views.
Step 6 - Test your project.
My project seems to be working, but make sure you check all area's. Time to run your unit tests, intergration tests and acceptance test!
That's it for me...let me know if you come across any other changes that you have had to make.