以编程方式将TestSettings文件添加到VisualStudio中的SolutionItems [英] Programmatically adding a TestSettings file to SolutionItems in VisualStudio
问题描述
((EnvDTE80.Solution2)dte.Solution).GetProjectItemTemplate("Test Settings", "Test");
((EnvDTE80.Solution2)dte.Solution).GetProjectItemTemplate("TestSettings.zip", "Test");
我需要以编程方式将新的TestSettings项添加到Visual中的解决方案Studio。
I need to add a new TestSettings item programmatically to a solution in Visual Studio.
要做到这一点,我需要获取模板文件的路径。对GetProjectItemTemplate的调用应该这样做,但是对于这种类型的模板失败了。其他模板类型,例如CSharp类,可以正常工作。即使是我已注册
的自定义类型也能正常工作。但不是TestSettings类型。
To do this I need to get the path of the template file. The call to GetProjectItemTemplate should do this, but fails for this type of template. Other template types, for example, a CSharp class, work fine. Even custom types that I have registered work fine. But not the TestSettings type.
GetProjectItemTemplate失败,FileNotFoundException异常
"任何已安装的软件包都不支持指定的语言。"
此zip文件中的模板可在此处找到:
Template in this zip file can be found here:
C:\\ \\ Program Program(x86)\ Microsoft Visual Studio 10.0 \ Common7 \IDE \ItemTemplates\Test \ 1033 \TestSettings.zip
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ItemTemplates\Test\1033\TestSettings.zip
C:\Program Files(x86) \ Microsoft Visual Studio 10.0\Common7\IDE\ItemTemplatesCache\Test\1033\TestSettings.zip
< span style ="font-family:Arial,'Liberation Sans','D ejaVu Sans',sans-serif">
为什么这个模板类型不起作用?
Why this template type doesn't work?
推荐答案
嗨德米特里,
我可以重复这个。现在调查一下。一旦我有机会对此进行调试,我会立即回复其他信息。
I can repro this. Looking into it now. Will post back additional info as soon as I've had a chance to debug this.
此致,
这篇关于以编程方式将TestSettings文件添加到VisualStudio中的SolutionItems的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!