Reputation: 844
ASP.NET MVC has a bunch of custom item templates to create controllers, views, etc. Those item templates appear to only show up in the Add New Item dialog box when you are inside an ASP.NET MVC project (or more specifically when the MVC project type guid is in the .csproj file). How do they manage to do this? I've looked through the .vstemplate files and there doesn't appear to be anything related to the project type guid.
Thanks, Nathan
Upvotes: 1
Views: 520
Reputation: 844
I believe I figured it out. It looks like the TemplateGroupID node in the .vstemplate file specifies the name of the VS Project (as read from the registry) to show this template for.
Upvotes: 1
Reputation: 180798
The logic for these is in the T4 templates.
The Add Controller and Add View dialogs both perform code generation that use T4 templates behind the scenes. These templates can be modified to customize the generated code from these tools. You can find the templates at the following location:
[Visual Studio Install Directory]\Common7\IDE\ItemTemplates[CSharp | VisualBasic]\Web\MVC\CodeTemplates\
Upvotes: 0