Error “Unable to copy the file xxx from the project template to the project. Can't find the file \xxxx” when create VS template

开源项目常常需要按照一定的模板创建项目代码, Visual Studio 的模板功能非常适合这种需要。

创建模板其实其实非常容易,使用VS的“Export Template”就可以轻松搞定。

image

不过如果想支持一些高级功能,比较根据项目名自动修改文件名,Namespace之类就需要一些手工工作了。具体可以参考: http://weblogs.asp.net/scottgu/archive/2005/09/09/424780.aspx

不过在修改完各种项目文件以及手工修改完.vstemplate文件后,在测试模板时得到这样的错误:

image

网上搜了一下,原因是还没有修改.csproj文件,需要在这个文件中同样替换如$safeprojectname”一样的参数。

网上的帖子:http://forums.asp.net/t/941773.aspx/1?Project+Templates+Error

原文地址:https://www.cnblogs.com/DotNetNuke/p/2347993.html