Autor Beitrag
MitgliedsnameUnbekannt
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 17



BeitragVerfasst: Mi 30.10.13 18:31 
Guten Abend :)

Ich habe eine Add In für Visual Studio gebastelt in dem ich unter anderem einen Ordner in der geöffneten Projektmappe erstellte und dort eine Datei reinlege (siehe Code).

ausblenden C#-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
//Solutionordner hinzufügen

Solution2 solution = (Solution2)m_Solution;
Project project = solution.AddSolutionFolder("neuerOrdner");


//Datei hinzufügen

string file = Path.Combine("filepath");
ProjectItem projItem = project.ProjectItems.AddFromFile(file);


Das funktioniert.
Nun möchte ich das neu erstellte gerne speichern, damit er mich beim schließen des geöffneten Programms nicht mehr fragt, ob ich die Änderungen speichern möchte.

Bisher führten Experimente wie folgende nicht zum Erfolg:

ausblenden C#-Quelltext
1:
2:
3:
4:
projItem.Save("");
project.Save("");
m_Solution.Projects.Item(2).Save();
projItem.ContainingProject.Save();


Hat jemand eine Idee oder einen Tipp für mich?

Danke [:


Moderiert von user profile iconChristian S.: Topic aus Basistechnologien verschoben am Mo 04.11.2013 um 11:31
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19315
Erhaltene Danke: 1747

W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Mi 30.10.13 20:51 
Ich denke mal du suchst das:
stackoverflow.com/qu...-all-programatically hat folgendes geschrieben:
ausblenden C#-Quelltext
1:
DTE.ExecuteCommand("File.SaveAll")					
MitgliedsnameUnbekannt Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 17



BeitragVerfasst: Do 31.10.13 09:52 
nein die Antwort ist dieses

ausblenden C#-Quelltext
1:
2:
string solutionPath = Path.Combine(ProjectPath, ProjektName + ".sln");
m_Solution.DTE.Solution.SaveAs(solutionPath);