Adding project from custom template to VS does not

2019-07-07 06:41发布

问题:

Using VS 2015 community edition, I created a custom template by exporting an existing project in my solution.

I used the custom template to add a new project to my solution. The solution is under source control in TFS.

After the adding, the solution is modified in TFS, reflecting the changes adding the new project, but the actual folder of the new project is not added to the TFS.

As a workaround, I can of course add the folder of the new project to the TFS manually, but I would expect it to be added automatically.

Is something wrong here?

回答1:

You can modify the exported project template, otherwise the new added project will be considered already in source control.

Please follow below steps to modify the template:

  1. Extract the template ‘*.zip‘ file
  2. Edit the project file (eg: *.csproj) with notepad, delete the source control section such as <SccProjectName>SAK</SccProjectName>
  3. Save the project file , select all the files and compress to a new template zip file
  4. Copy the zip containing the template to that ProjecTemplates folder.(User folder\Documents\Visual Studio 2015\Templates\ProjectTemplates.)

Another way is exporting the project template before adding the solution to source control.