如何在Visual Studio 2015中删除重复的类模板 [英] How to remove duplicate class template in Visual Studio 2015

查看:164
本文介绍了如何在Visual Studio 2015中删除重复的类模板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我选择菜单时,在Visual Studio 2015的解决方案资源管理器中的项目中添加新项,并想要选择新的类模板,我会看到复制此模板.如何解决?

When I select menu add - new item in my project on solution explorer in Visual Studio 2015 and want select new class template i see duplication this template. How to fix it?

推荐答案

Besha,

我遇到了同样的问题,我确定这是由Xamarin项目模板引起的.这些模板使用与本地VS Studio模板相同的定义,例如:

I've encountered the same problem, which as I'm sure is caused by Xamarin item templates. These templates use the same definitions as native VS studio templates, e.g.:

名称包="{FAE04EC1-301F-11d3-BF4B-00C04F79EFBC}" ID ="2245"

Name Package="{FAE04EC1-301F-11d3-BF4B-00C04F79EFBC}" ID="2245"

因此,当VS向您显示项目时,它将以重复的名称结尾.

Thus, when VS shows you the items it ends up with duplicate names.

要解决此问题,我已经扫描了包含上述GUID的所有模板文件(* .vstemplate),并用适合我需要的文本替换了Name元素.例如.对于Xamarin类,我将其更改为: Xamarin C#类 而不是Package =".....

To fix the problem I've scanned all the template files (*.vstemplate) containing the mentioned above GUID and replaced the Name element with a text that suites my needs. E.g. for the Xamarin class I've changed it to be: Xamarin C# class instead of Package=".....

请注意,VS使用模板缓存,并且VS本机模板和第三方模板的缓存不同.对于Xamarin,将存在包含模板的ZIP文件和包含从存档中提取的模板的缓存文件.例如:

Note, that VS uses caching of templates and the caching is different for VS native templates and third party templates. In case of Xamarin, there will be ZIP files containing the templates and cached files with templates extracted from the archives. E.g.:

c:\ Program Files(x86)\ Microsoft Visual Studio 14.0 \ Common7 \ IDE \ Extensions \ Xamarin \ Xamarin \ 3.11.785.0 \ T \〜IC \ IT \ Code \ GeneralClass.zip \

c:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Xamarin\Xamarin\3.11.785.0\T\~IC\IT\Code\GeneralClass.zip\

将包含提取的模板,而原始存档位于其中: c:\ Program Files(x86)\ Microsoft Visual Studio 14.0 \ Common7 \ IDE \ Extensions \ Xamarin \ Xamarin \ 3.11.785.0 \ T \ IT \ Code \ GeneralClass.zip

will contain the extracted templates, while the original archive is there: c:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Xamarin\Xamarin\3.11.785.0\T\IT\Code\GeneralClass.zip

您的目标是找到未缓存的模板并在那里更改Name元素.

Your goal is to find the non-cached templates and change the Name element there.

找到并修复了name元素后,关闭Visual Studio,以管理员身份启动命令提示符,然后转到 c:\ Program Files(x86)\ Microsoft Visual Studio 14.0 \ Common7 \ IDE文件夹 并运行以下命令:

Once you've found and fixed the name element, close Visual Studio, launch the command prompt as administrator, go to the c:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE folder and run the following command:

devenv /installvstemplates

需要一段时间.

希望如此之后,您将不会看到重复的课程项目.

Hopefully, after that you won't see duplicated class items.

致谢.

这篇关于如何在Visual Studio 2015中删除重复的类模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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