Dugald Wilson's Blog

Another waste of your free time.
posts - 49, comments - 48, trackbacks - 1

Missing MVC Templates in Project

 

I’m working with SharpArchitecture as the basis for a new project at work, and found a small surprise when trying to add a view:

 NoMVCTemplates

No MVC items anywhere in that list. Sure, it’s not a huge hassle to create a webform page and change the details so it inherits from ViewPage, but I’d like to have the ease those templates provide.

The reason those templates don’t appear is that  the SharpArchitecture template is generated such that it doesn’t depend on ASP.Net MVC being installed on the development machine. This helps for compatibility with multiple versions. The downside is no easy-peasy templates out of the box in Visual Studio.

To add those templates to your SharpArchitecture project (or any project not built directly from the MVC project template) should only take a few steps:

  1. In Visual Studio, create a new MVC project using the Project Templates.
  2. Open the project’s *.csproj file with a text editor.
  3. In the opening section you will find a list of ProjectTypeGUIDs. Copy the first GUID listed. Note: the GUID shown below is for MVC2 RC, your GUID may differ:

     

    CopyGUID

  4. Paste that GUID into the *.csproj file for your project that is missing the templates. For a SharpArchitecture project, this will be the *.Web.csproj file.

Once done, you should be able to see MVC item templates in your SharpArchitecture web project.

MVCTemplates

Print | posted on Thursday, February 18, 2010 8:28 AM | Filed Under [ .Net SharpArchitecture ASP.Net MVC ]

Feedback

Gravatar

# re: Missing MVC Templates in Project

Thank you for posting this solution to this most unpleasant problem.
8/5/2010 12:25 PM | Bernie from Oceanside CA
Gravatar

# re: Missing MVC Templates in Project

thanks for the informatin....
1/23/2012 7:06 AM | hemorrhoid treatment

Post Comment

Title  
Name  
Email
Url
Comment   
Please add 1 and 5 and type the answer here:

Powered by: