Search code examples
visual-studio-templates

Visual Studio Template - How DO I Copy a .gitignore file to the root folder where the .sln file exists?


I have created a multi project visual studio template .vstemplate file. It creates 3 projects and the folders look like this in windows explorer:

Project1
Project2
Project3
Project.sln

I want to include and copy a .gitignore file to the root directory where the .sln file is located. How can I perform this task using the vstemplate xml syntax?


Solution

  • This is not possible using the traditional visual studio template approach. I found a newer way to do this using the dotnet new template approach. This gives you much more flexibility and is a newer approach to project templates. Check out the documentation here:

    https://learn.microsoft.com/en-us/dotnet/core/tools/custom-templates