Another way to Get Start ASP.NET MVC 3 (Preview 1)

Update:  This article is outdated. Now ASP.NET MVC 3 depends on more than one assemblies. 

 

     Introduction:

          A month ago when the ASP.NET MVC team released ASP.NET MVC 3 (Preview 1). Lot of developers enjoyed and tested this release. But still many developers unable to install ASP.NET MVC 3 (Preview 1) in their machine due to various reasons. Some developers claimed at here and here that MVC 3 (Preview 1) installed successfully but when they create a new MVC 3 project then Visual Studio says, 'The project type is not supported by this installation'. Some developers don't like to install new software just for testing new features. Some developers don't have permission to install the ASP.NET MVC 3 on their machine currently but keen to see and test the new features. So in this article I will show you how get ASP.NET MVC 3 (Preview 1) running on their machine another way.

 

    Description:

          First of all create a new ASP.NET MVC 2 application. Then open the Find and Replace window and select Current Project(or Entire Solution) from the Look in combo box and replace,

System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35

with,

System.Web.Mvc, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null

 

 

           

 

           

           Now remove the reference of System.Web.MVC assembly from your project.

           

           

 

            Now download the MVC 3 source from here and unzip this file. Inside this unzip file you will find SystemWebMvc folder which contains MVC 3 project. Now right click your solution and select Add Existing Project, then browse and select this MVC 3 project file.

 

             

           

 

            Now add a reference of this project to your MVC application,

 

          

 

           That's all! Now let's add a razor view in your application to see razor view engine in action. Right-click on Views/Home folder in solution explorer and select Add New Item and then select Text File and name it as CshtmlIndex.cshtml.

 

            

 

           

           

 

           Then add the following lines in this file,

 

         @inherits System.Web.Mvc.WebViewPage<dynamic>
         <h2>@ViewData["Message"]</h2>

 

           Next add the following lines in HomeController,

 

        public ActionResult CshtmlIndex()
        {
            ViewData["Message"] = "Welcome to ASP.NET MVC Preview 1 with Razor!";

            return View();
        }

 

           Now run your application and browse to /Home/CshtmlIndex, you will find the following screen,

 

           

 

           How easy to get start with MVC 3  (Preview 1)  without any installation. Another benefit of using this approach is that you can easily debug MVC source now.

    Summary:

          In this article I showed you how to get start ASP.NET MVC 3 (Preview 1) without any installation. Hopefully this will help you to start using and testing new features of ASP.NET MVC 3 (Preview 1) quickly if you still had not tested ASP.NET MVC 3 (Preview 1) features or unable to get start ASP.NET MVC 3 (Preview 1) due to various reason. Hopefully you will enjoy this article too.
 

1 Comment

Comments have been disabled for this content.