I have an application that creates a visual studio solution programmatically and loads project and files that I created in VS2010. I would like to know how to automatically save the solution including project files that is not displaying the dialog box to save the solution file.
Code below:
Type type = Type.GetTypeFromProgID("VisualStudio.DTE.10.0");
Object obj = System.Activator.CreateInstance(type, true);
EnvDTE80.DTE2 dte8Obj = (EnvDTE80.DTE2)obj;
Solution2 soln = (Solution2)dte8Obj.Solution;
Solution2 soln2 = (Solution2)dte8Obj.Solution;
Project prj;
ProjectItem prjItem;
string prjPath = @"C:\SaveLocation\";
string prjName = "ProjectName";
soln.Create(prjName, prjName);
soln.DTE.MainWindow.Visible = true;
string csTemplatePath = soln2.GetProjectTemplate("WebApplicationProject40.zip", "CSharp");
soln.AddFromTemplate(csTemplatePath, prjPath + prjName, prjName, false);
prj = soln.Projects.Item(1);
save & asking for a file name and quit... For here I would like to save it automatcially.
dte8Obj.ExecuteCommand("File.SaveAll");
dte8Obj.Quit();