Compartilhar via


Creating MVC 2 Web Role in Visual Studio 2010 cause error - "The project template referenced by the roletemplatedata.xml file cannot be found"

Recently I was working on an issue in which Azure Partner reported the following issue:

When creating MVC2 Web Role in Visual Studio 2010, the following error dialog occurred and MVC2 Web Role based project could not be created. 

- "The project template referenced by the roletemplatedata.xml file cannot be found"

 

Troubleshooting:

After I used Process Monitor to collect the file system log for DEVENV.EXE (Visual Studio) Process I found the following:

-
When using the MVC 2 Web Role template Visual Studio is actually using MVC3 libraries
which i found surprising

-
Azure only Supports MVC2 based template so far with Windows Azure SDK 1.4 refresh *yet*

 

When I compared my machine which can create MVC2 Web Role without any problem I found the Web Role does use proper MVC 2 Web Role template 

 

Further investigate reaveled the following important facts which caused the problem:

  1. The machine which showed this problem had Telerik components installed with Visual Studio 2010
  2. The Telerik VS2010 components removed base MVC 2 template and replaced with Telerik MVC2
    Template
  3. When VS2010 searches for its default MVC 2 template, it is no
    where to found as it is overwritten by Telerik MVC 2 template which cause VS2010 to throw the error.
  4. Due to Telerik components, I was also not able to create a default MVC2 web application in the
    same machine using VS2010 because it has been overwritten by Telerik
    components so users can create only Telerik based MVC 2 web application.

 

Solution:

If you really want to create MVC 2 Web Role based application with Visual Studio 2010 then the only solution I found is to remove Telerik components for Visual Studio 2010 or work with Telerik to find a way to keep the original MVC 2 Template along with Telerik MVC 2 Template. Telerik components are messing with base MVC 2 Template which cause this problem. 

If you still want to keep Telerik components, you can generate a sample MVC2 web role solution on a machine which does not have Telerik components installed and use as
base MVC 2 Web Role Azure application. I did test it and a MVC 2 Web Role created on my machine did work fine on a machine which have Telerik components installed.