Make VS2012 MVC4 VSIX template to work for Visual Studio 2013 preview

Make VS2012 MVC4 VSIX template to work for Visual Studio 2013 preview

Rate This
  • Comments 1

Visual Studio 2012.2 supports customized MVC4 template, you can get a walkthrough here: http://blogs.msdn.com/b/yjhong/archive/2012/12/13/custom-mvc-4-template-walkthrough.aspx or http://www.asp.net/mvc/overview/getting-started/custom-mvc-templates. But the created template VSIX file cannot be uploaded to VS Gallery at the time. Starting 6/26/2013, you can upload the MVC4 template VSIX files to VS Gallery now.

The VS2012.2 created VSIX may not install or work for Visual Studio 2013 preview, however. We need to fix a few thing in the following steps.

1. Change source.extension.vsixmanifest file InstallationTarget version from “11.0” to “[11.0,12.0]” in order to support both VS2012 and VS2013 preview, for example:

<Installation AllUsers="true">

<InstallationTarget Version="[11.0,12.0]" Id="Microsoft.VisualStudio.Pro" />

<InstallationTarget Version="[11.0,12.0]" Id="Microsoft.VisualStudio.VWDExpress" />

</Installation>

In Visual Studio 2012 spec, it mentioned Version=”11.0” means VS2012 and all future VS releases. But in Visual Studio 2013 preview, this is changed to mean that version of VS only. Changing it to “[11.0,]” to support VS2012 and all VS release in the future. Changing it to [11.0,12.0] to support both VS2012 and VS2013. Changing it to “12.0” to support VS2013 only.

2. In your vstemplate file, if you have such field specified to reduce the VSIX size and allow VSIX to use packages installed locally with VS2012.2 installations:

<packages repository="registry" keyName="AspNetMvc4VS11" isPreunzipped="true">

<package id="xxxxx" version="x.x.x" skipAssemblyReferences="true" />
...

</packages>

You will need to change the keyName value to “AspNetMvc4VS12” to support machines that has Visual Studio 2012 preview but does not have Visual Studio 2012 installed. This is because registry value name changed from “AspNetMvc4VS11” to “AspNetMvc4VS12” in HKLM\Software\NuGet\Repository. If you do this way, you will have to create two versions of VSIX, one for VS2012 and one for VS2013 preview.

If you still want to use one VSIX to support both VS2012.2 and VS2013 preview, you will need to include all the packages in the VSIX file and do not depend on the different package versions that installed along with each version of Visual Studio.

Now, you should be able to create the template successfully in VS2013 preview by going through “Web -> Visual Studio 2012 -> ASP.NET MVC 4 Web Application”.

Please test your VSIX file with Visual Studio 2013 preview and make changes if needed.

Thank you for your support.

Leave a Comment
  • Please add 3 and 7 and type the answer here:
  • Post
Page 1 of 1 (1 items)