Custom Visual Studio 2013 project templates

How to create and use a customized Visual Studio 2013 project template.

.

Easy ‘new project’ creation

A well-configured app – web app, or web service – requires a lot of work.

Often, you create a new project with the “ASP.NET Web Application” template, with or without an authentication component.

Then, you may have to add the Entity Framework. And AutoMapper. And several other components.

Next, you create a file for your design model classes. And the data manager class. And many others.

It would be nice to save all this work as a ‘template’ that you could reuse for new projects.

Can you do that?

Yes.

.

Visual Studio 2013 “Export Template”

Configure a project with the components and files you want.

Then, on the Visual Studio 2013 “FILE” menu, choose “Export Template” to start the wizard.

Select “Project template”, and go to the next panel.

Complete these fields:

  • Template name (keep the name short)
  • Template description (it appears that this is limited to about 250 characters)
  • Icon image (can be ico, png, jpg)

For the icon image, you can use this, if you wish:

VS2013ASPNETWebAppProjectIcon

.

Un-check (clear) the “Automatically import the template into Visual Studio” checkbox.

export-template-configure

.

Click the Finish button.

A File Explorer window will open, showing the contents of your “My Exported Templates” folder. Select and copy the zip file that matches the template you just exported.

Navigate to this folder. You must create the “Web” subfolder:

%userprofile%\Documents\Visual Studio 2013\Templates\ProjectTemplates\Visual C#\Web

.

Paste the zip file into this folder.

Your new template will now appear when you create a new project in Visual Studio.

The image below shows how the wizard values match up to the items in the New Project dialog. Click to view full-size in its own tab/window.

export-template-configure-values-mapping

.

After creating the new project, build/compile.

Then, edit the project properties. On the Web tab, change the “Project Url” port number. (Suggestion – add 2 to the existing port number.) Save your changes. (Click the image to open it full-size in a new tab/window.)

template-edit-properties

.

Then you can run/load the project. If an error dialog appears, then edit the project properties again, and change the port number again.

template-run-error

.

Other supporting info

MSDN: How to: Locate and Organize Project and Item Templates

Visual Studio Magazine: Develop Faster with Customized Visual Studio Templates 
(read the part about creating your own custom folder/container for the left-side navigator)

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: