how rename a folder inside project template to project's name? (visual studio template customization)

白昼怎懂夜的黑 提交于 2019-12-21 12:16:38

问题


I created a project template in Visual Studio 2010. When I click on Project -> File -> Export Template, I get a zip file in the Visual Studio template folder. In the solution, I have a folder named Test.

When I create a solution from that template (from add -> new project dialog), I want to rename the Test folder's name to the solution's name automatically.

How can I do that?


回答1:


  1. Get the files out of the zip file
  2. In "MyTemplate.vstemplate", change TargetFolderName="Test" to TargetFolderName="$projectname$"
  3. In the .csproj file, change everything that refers to folder "Test" to "$projectname$" (including paths, etc.)

This should work.

Additional info:

https://msdn.microsoft.com/en-us/library/ahkztdcb.aspx (Visual Studio project template info) https://msdn.microsoft.com/en-us/library/eehb4faa.aspx (Visual Studio template macros reference)



来源:https://stackoverflow.com/questions/9190741/how-rename-a-folder-inside-project-template-to-projects-name-visual-studio-te

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!