有没有办法自动添加/包含新文件/文件夹到Visual Studio项目中或使用命令行工具添加/包含它们?
答案 0 :(得分:2)
您可以从VB Script访问Visual Studio自动化。请参阅以下示例.vbs文件,该文件可以作为可执行文件运行:
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()