VS2017 community創建模板錯誤 The document cannot be opened. It has been renamed, deleted or moved
阿新 • • 發佈:2018-08-05
nbsp rom ng- 模板生成 sfm visual mat block ati
當我使用我自己創建的模板生成工程,打開文件時,會出現“The document cannot be opened. It has been renamed, deleted or moved”錯誤提示。
好像這個bug只在community版本中。
這時我們需要手工去修改模板文件
Here‘s how I solved this issue:
- Follow your steps 1 to 6
- At step 7 make sure to uncheck "Automatically import the template into Visual Studio"
- Click Finish
- Extract the just created zip file of your template into a folder of your choice
- Now copy all your source (.cpp) and header (.h) files from your original SFML project to the extracted folder
- In this folder look for MyTemplate.vstemplate and open it in a text editor
- You will see a TemplateData and TemplateContent section
- Inside the TemplateData section add the line <CreateInPlace>true</CreateInPlace>
- Inside the TemplateContent section add for each copied file from step 5 the lines
<ProjectItem ReplaceParameters="false" TargetFileName="filename.cpp">filename.cpp</ProjectItem> or
<ProjectItem ReplaceParameters="false" TargetFileName="filename.h">filename.h</ProjectItem>- Now put all files back into a zip file
- Copy your new zip file to Visual Studio 2015\Templates\ProjectTemplates folder
- Restart Visual Studio and open a new project from your project template
參考自:https://social.msdn.microsoft.com/Forums/vstudio/en-US/24b38dbb-c445-47a4-a05b-c9c12cfa6a6b/visual-studio-community-2015-source-file-missing-from-template?forum=vssetup
VS2017 community創建模板錯誤 The document cannot be opened. It has been renamed, deleted or moved