I wanted to know how to use the template for an Empty Visual C++ project to programmatically create a new solution with this empty project. The code (C#) I have right now is:
string VSProgID = "VisualStudio.Solution.10.0";
Type solnObjType = System.Type.GetTypeFromProgID(VSProgID, true);
Solution4 soln = (Solution4) System.Activator.CreateInstance(solnObjType, true);
soln.Create(@"C:\NewSoln", "New");
soln.SaveAs(@"C:\NewSoln\New.sln");
string emptyVCProjPath = soln.GetProjectTemplate("General/Empty Project", "VC++"); // Here's where I need help
soln.AddFromTemplate(emptyVCProjPath, @"C:\NewSoln\NewProj", "New.vcxproj", false);
I wasn't able to find the VC++ Empty Project template in the location where all the other templates (C#/F#/VB) are located. The VC++ Empty Project Template does appear in the installed templates when I create a new project manually through the IDE. What should the parameters be for soln.GetProjectTemplate()
? It doesn't seem to recognize "VC++"
as a language. I know that "CSharp"
and "VisualBasic"
are valid options. But I wanted a VC++ Empty Project. Any help will be greatly appreciated.