eKek0
eKek0

Reputation: 23289

How to run ASP.NET MVC 1 and 2 on the same machine?

I have developed a site using MVC 1, then updated to MVC 2 Preview 1 and now when I open the site I found the error:

The project type is not supported by this installation.

Since I want to stick this project with the version 1, but also I want to create my new projects with version 2, how can I resolve this already made project to run with ASP.NET MVC 1 while having installed version 2?

I guess the solution goes in the path of resolving some references in web.config, but I don't know exactly what.

Upvotes: 3

Views: 138

Answers (1)

Craig Stuntz
Craig Stuntz

Reputation: 126547

You need to correct the project type Guid in the csproj file. Older versions of MVC (previews) used a different Guid. Your project can still link to MVC 1, though.

To fix this:

  1. Make sure the project is checked into source control, in case anything goes wrong.
  2. Right click on Web project in Solution Explorer. Click "Unload project"
  3. Right click again, choose "Edit .csproj"
  4. Find ProjectTypeGuids, replace with the value below.
  5. Save, then right click and reload project.
  6. Test like crazy to ensure it's still working as you expect with MVC 1. Make sure you've specified strong names for the MVC 1 assemblies instead of bin deployment. With both versions in the GAC, you'll need strong names.

    <ProjectTypeGuids>{F85E285D-A4E0-4152-9332-AB1D724D3325};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
    

Also, MVC 2 projects need a bindingRedirect in Web.config. The MVC 2 release notes say this is needed only "if the project references any third-party libraries that are compiled against ASP.NET MVC 1.0," but they're wrong.

Upvotes: 1

Related Questions