Adding a TestSettings file to SolutionItems in VisualStudio

5.4k views Asked by At
((EnvDTE80.Solution2)dte.Solution).GetProjectItemTemplate("Test Settings", "Test");

I need to add a new TestSettings object programmatically to a C# project in Visual Studio. 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.

You can see the template in this zip file:

C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ItemTemplates\Test\1033\TestSettings.zip

Any idea why this template type doesn't work?

2

There are 2 answers

0
jlo-gmail On

In VS 2017 it is there under the solution. Right click on Solution|Add Item...|Test Settings

0
Stephen Gennard On

You are not the only person to have issues with "test settings", a chap on the forum below resorted to unloading, editing the project xml and reloading it in order to update the settings...

Its a bit of a faff but it could be some solution..

http://social.msdn.microsoft.com/Forums/en-US/vsx/thread/a1160459-23e3-4bd4-a672-d204eb9ffa4c/