How can I create an empty Visual C ++ project?

I wanted to know how to use the template for an empty Visual C ++ project to programmatically create a new solution using this empty project. The code (C #) that I have now:

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 where I need help
soln.AddFromTemplate(emptyVCProjPath, @"C:\NewSoln\NewProj", "New.vcxproj", false);

I could not find the VC ++ Empty Project project template in the place where all the other templates are located (C # / F # / VB). The VC ++ Empty project template appears in the installed templates when I create a new project manually through the IDE. What should be the parameters for soln.GetProjectTemplate()? It does not seem to recognize it "VC++"as a language. I know that "CSharp"and "VisualBasic"are valid parameters. But I need a VC ++ Empty project. Any help would be greatly appreciated.

+2
source share
1 answer

I am posting this answer in the hope that it can help someone encounter the same problem that I am facing.

-, API Visual Studio Extensibility Visual ++ . . , [solution_name].sln, [project_name].vcxproj [project_name].vcxproj.filters . GUID . , ClInclude ClCompile . [project_name].vcxproj [project_name].vcxproj.filters. Visual ++, , . .


UPDATE

- V++ ( Windows). Visual Studio .

+3

Source: https://habr.com/ru/post/1609019/


All Articles