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:
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:
- In Visual Studio, create a new MVC project using the Project Templates.
- Open the project’s *.csproj file with a text editor.
- 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:
- 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.
