MapAreaRoute Removed from ASP.NET MVC 2 RC
When I upgraded my CMS to ASP.NET MVC 2, I ran into some problems such as a missing assembly and some routing code changes.
Let's flash back to when I started developing with ASP.NET MVC pre-2.
When I started building my CMS (Content Management System) using ASP.NET MVC 2 Preview 2, Areas were a major factor in my development. I was elated that the ASP.NET MVC Team integrated them into the release, but I ran into a problem...where do I start?
I didn't know how to start building the separate projects to create my modular CMS. After some searching, I found the Walkthrough: Creating an ASP.NET MVC Areas Application using Multiple Projects post. Awesome! This is what I was looking for.
After reading the walkthrough, everything was working fantastic! I'm currently using it today.
Now, flash forward to now. This weekend to be precise.
Since my CMS uses the new feature of areas, I tried to compile my application and ran into the problem of an unknown method called MapAreaRoute. It was there in the Preview 2 release, but now, not in the Release Candidate. In addition to that, I was having a problem "copying" over the areas into my host application. I received an error regarding a missing reference and method called CreateAreaManifest.
Fix the Compile!
First problem was the compiling. I had to get my CMS to compile. After more research, I found a post about Areas in ASP.NET MVC 2. If you have the Google toolbar, just click translate if you really want to read it, but the code should be enough to help you understand what needs to be done.
After changing all of my area "routes.cs" and my global.asax in my main application, everything compiled! Excellent!
Now, the build/copy process
After looking around and doing the research, I was worried that other developers weren't using Areas in ASP.NET MVC either, but I did find this post over at haacked.com (where else?) which explained a couple of things. In ASP.NET MVC 2 RC, they removed an assembly called Microsoft.Web.Mvc.Build.dll.
Ah-HA! I looked for it in futures, but couldn't find it. So I proceeded with the following steps:
- Uninstalled ASP.NET MVC 2 RC.
- Downloaded and installed ASP.NET MVC 2 Preview 2.
- Copied the Microsoft.Web.Mvc.Build.dll to another directory
- Uninstalled the ASP.NET MVC 2 Preview 2
- Reinstalled the latest version of ASP.NET MVC: ASP.NET MVC 2 RC.
I copied the DLL into the C:\Program Files\Microsoft ASP.NET\ASP.NET MVC 2\Assemblies directory and recompiled my application.
After a swift open-handed strike to the forehead, I remembered I needed to add the assembly to the GAC by issuing the following command at the command prompt:
gacutil /i Microsoft.Web.Mvc.Build.dll
I started Visual Studio and compiled...and built! Success!
Even though this was a struggle to get everything functioning over the weekend, I'm very impressed with the ASP.NET MVC 2 team for this release and how they made Areas even more modular. The changes made to my code were minimal, so kudos go out to the team!
UPDATE: Problem is not solved. I'm working on a solution, but here is an update as to where I'm currently at.
Jonathan Danylko is a freelance web architect and avid programmer who has been programming for over 20 years. He has developed various systems in numerous industries including e-commerce, biotechnology, real estate, health, insurance, and utility companies.
When asked what he likes doing in his spare time, he answers..."programming."
Like this article?Subscribe for FREE to receive the latest posts before they become public.
- Security in Web Applications
- UPDATE: Multiple Project Area Support for ASP.NET MVC 2 RC
- MapAreaRoute Removed from ASP.NET MVC 2 RC
- Speed Links: ASP.NET MVC
- Microsoft Monday: August 17, 2009