Project template for Visual Studio 2015
Asked Answered
N

2

8

I am trying to create a project template for Visual Studio 2015. I created a ASP.NET 5 class library (under the web section of Visual studio 2015) and used the option File->Export template. When I tried to create project using the exported template, only the .xproj file gets created. The files within the template and the dependencies are not getting added. But the same procedure works fine for normal class library project. Am I missing something.?

Noella answered 24/11, 2015 at 5:41 Comment(1)
Hey Anandha could you please accept @Bebben's answer? It worked for me, and judging by the up votes it's a generally accepted answer.Flanna
N
18

I found the way to do this. Open up the zipfile and edit the .vstemplate file. The line that is missing is

<CreateInPlace>true</CreateInPlace>

This line goes between

<TemplateData></TemplateData>

This solves the problem for .NET Core 1.0.1 Tooling Preview 2, VS2015 Update 3.

Nylons answered 27/9, 2016 at 7:44 Comment(2)
Worked perfectly for me .NET Core 1.0.1 etc. Thanks!!Klepht
This is still the answer for VS2017. Wish this got the check.Flanna
O
3

In order to solve this, I had to extract the output zipfile, and edit the .vstemplate file.

Removing the TargetFileName attribute from the <Project> element under <TemplateContent> worked, and the new .xproj file was correctly named.

The relevant part of the .vstemplate file looked like this:

<TemplateContent>
  <Project TargetFileName="MyProject.xproj" File="MyProject.xproj" ReplaceParameters="true">

And I changed it to:

<TemplateContent>
  <Project File="MyProject.xproj" ReplaceParameters="true">

The inspiration for this came from looking at the ASP.NET 5 project templates, and specifically the empty web's .vstemplate file.

Orvie answered 8/12, 2015 at 20:39 Comment(1)
This did not work for me. Visual Studio 2015 Update 2Gaston

© 2022 - 2024 — McMap. All rights reserved.