Can't find C# class template file in Visual Studio folder
I am trying to create an Visual Studio 2010 Add-In that when run adds a class to the opened solution's first project using EnvDTE.
I've managed to create the add-in, get the reference to the opened solution and get the reference to the first project.
Then I want to create the class, and I've found the following code:
String templatePath = sol.ProjectItemsTemplatePath(PrjKind.prjKindCSharpProject);
templatePath += @"\CSharpAddClassWiz.vsz";
The path points to a template file that does not exist. Everywhere I try to get this file, it’s stated that “you could find it in Microsoft Visual Studio 10.0\VC#\CSharpProjectItems”
Here’s the entire content of this folder in my installation of Visual Studio 2010:
http://i.stack.imgur.com/YFsMw.png
In fact I’ve searched for the file, and even for *.vsz in my entire hard drive, and nothing was found.
I have two questions:
1) Did I install Visual Studio incorrectly, so that this file is not available in the Visual Studio folders?
2) How can I get this file, even if it is a copy of it?I do realize that having a copy of it and shipping it in with my Add-In would mean that in the future, people could generate classes with an old template, rather than the updated ones found in their Visual Studio folders, but I just want to proceed with my tests, generate this class, and move on until I have the first question solved.
There are two things that intrigue me on开发者_如何学运维 this matter:
- Doesn't Visual Studio use these files while I'm creating classes through it's wizards?
- I have Visual Studio 2008 installed too, and it also lacks these files.
You may have to run a repair on Visual Studio, it is likely that there was an error during the install.
精彩评论