Is there a way to automatically add/include new files/folders into a Visual Studio project or to add/include them using a command line tool?
1 Answer
You can access Visual Studio automation from VB Script. See the following sample .vbs file that can be run as an executable:
Dim dte Dim project Set dte = CreateObject("VisualStudio.DTE.11.0") dte.Solution.Open("C:\Users\sv\Documents\Visual Studio 2012\Projects\ConsoleApplication1\ConsoleApplication1.sln") For Each project In dte.Solution.Projects If project.Name = "ConsoleApplication1" Then project.ProjectItems.AddFromFile("C:\Users\sv\Documents\Visual Studio 2012\Projects\ConsoleApplication1\ConsoleApplication1\1.txt") project.Save(project.FullName) End If Next dte.Solution.Close()