自定义模板在Visual Studio 2015社区全新安装中不起作用 [英] Custom templates not working in Visual Studio 2015 Community Fresh installation

查看:110
本文介绍了自定义模板在Visual Studio 2015社区全新安装中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已在2015年Visual Studio社区中为我的项目创建了自定义模板,该计算机上已更新了VS的早期版本(历史记录).但是,在全新安装的Surface Pro 4上,它们无法正常工作.当我创建一个新项目时 使用自定义模板,在新项目中找不到我作为模板一部分创建的cpp或h文件.我正在使用与另一台计算机上完全相同的步骤.您知道可能是什么问题吗?

I have created custom templates for my projects in 2015 Visual Studio Community on a computer with previous versions of VS that have been updated (history). However, on a Surface Pro 4 with a fresh install they aren't working. When I create a new project with the custom template none of the cpp or h files that I created as part of the template can be found in the new project. I am using exactly the same procedures that are successful on my other computer. Do you know what the problem might be?

我已经进行了进一步检查,现在这也是我的台式计算机存在的问题.唯一改变的是我们正在做一个项目,并且我添加了一个Team Foundation.既然文件在那里,我想我需要恢复为任何文件 该配置是在我开始使用TF之前进行的.我们没有自己的服务器,因此我们正在使用在线方法.

I have checked further and now this is also a problem with my desktop computer. The only thing that has changed is that we are doing a project and I have added a Team Foundation. Since the files are there, I would guess that I need to revert to whatever the configuration was before I started using TF. We do not have our own server so we are using the online approach.

谢谢.

克雷格

推荐答案

Craig,

Hi Craig,

>>当我使用自定义模板创建新项目时,在新项目中找不到作为模板一部分创建的cpp或h文件.

>> When I create a new project with the custom template none of the cpp or h files that I created as part of the template can be found in the new project.

您旁边的错误消息是否如下所示?我也遇到了同样的问题.当我打开.ccp或.h文件时,出现以下弹出窗口.

Does the error message like below in your side? I also encountered the same issue in my side. And I got the below popup when I opened the .ccp or .h files.

有人已将有关此问题的反馈发布到Microsoft Connect:

Someone has posted a feedback about this issue to Microsoft Connect: https://connect.microsoft.com/VisualStudio/feedback/details/2894593/problem-about-export-template-from-c-project

您可以在该页面上对其进行评论和投票,Microsoft的工程师将对其进行认真评估.

You may comment and vote it at that page, and engineers from Microsoft will evaluate it seriously.

该页面上还有一个变通方法供您参考,我在下面粘贴了该变通方法:

There is also a workaround on that page for you to refer to, I just pasted below:

您需要在zip文件中修改生成的.vstemplate文件,以包括项目中所有源文件的条目:

You need to modify the resulting .vstemplate file within the zip file to include the entries for all the source files that were part of the project:

以下是一个示例:

    < ProjectItem ReplaceParameters ="false" TargetFileName =" Win32DialogBox.cpp"> Win32DialogBox.cpp</ProjectItem>

     <ProjectItem ReplaceParameters="false" TargetFileName="Win32DialogBox.cpp">Win32DialogBox.cpp</ProjectItem>

    < ProjectItem ReplaceParameters ="false" TargetFileName ="resource.h"> resource.h</ProjectItem>

     <ProjectItem ReplaceParameters="false" TargetFileName="resource.h">resource.h</ProjectItem>

    < ProjectItem ReplaceParameters ="false" TargetFileName =" Win32DialogBox.h"> Win32DialogBox.h</ProjectItem>

     <ProjectItem ReplaceParameters="false" TargetFileName="Win32DialogBox.h">Win32DialogBox.h</ProjectItem>

    < ProjectItem ReplaceParameters ="false" TargetFileName =" Win32DialogBox.rc"> Win32DialogBox.rc</ProjectItem>

     <ProjectItem ReplaceParameters="false" TargetFileName="Win32DialogBox.rc">Win32DialogBox.rc</ProjectItem>

,然后将源文件添加到zip文件中.我可以通过将添加/修改的文件拖放到zip文件的顶部来完成此操作.

现在,我发现zip文件位于两个到三个不同的位置:

1)%userprofile%\ Documents \ Visual Studio 2015 \ My Exported Templates";

2)%userprofile%\ Documents \ Visual Studio 2015 \ Templates \ ProjectTemplates";和

3)有时在以下位置之一%userprofile%\ AppData \ Roaming \ Microsoft \ WDExpress \ 14.0 \ ProjectTemplatesCache"或%userprofile%\ AppData \ Roaming \ Microsoft \ VisualStudio \ 14.0 \ ProjectTemplatesCache",具体取决于哪个版本 您正在使用的VS2015版本.

3) sometimes at one of these locations "%userprofile%\AppData\Roaming\Microsoft\WDExpress\14.0\ProjectTemplatesCache" or "%userprofile%\AppData\Roaming\Microsoft\VisualStudio\14.0\ProjectTemplatesCache", depending which Edition of VS2015 you are using.

请尽可能将回复标记为答案,以便其他有相同问题的成员进行投票和评论.感谢您的理解与合作.

If it’s possible, please mark the reply as answer which will let other members who have the same issue to vote and comment it. Thanks for your understanding and cooperation.

最诚挚的问候

弗莱彻


这篇关于自定义模板在Visual Studio 2015社区全新安装中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆