我怎么可以一次使用一个批处理文件的MSBuild解决方案在多个目录? [英] How can I use a batch file to MSBuild solutions in multiple directories at once?
问题描述
我是一个刚起步的公司实习。我不知道批处理文件,XML文件,在命令提示符下的MSBuild或任何东西。我只知道C#的基础知识。
我被要求做一个批处理文件,它允许用户在目录中建立所有的解决方案,有七子,在一个命令。我知道如何建立一个文件夹中一个解决方案(通过使用的MSBuild mysolution.sln
),但来自七个不同的文件夹是超越我建立多个解决方案。
有可能使一个批处理文件,它允许的MSBuild找到所有解决方案文件中的子文件夹和建立他们一下子?
在此先感谢的人谁可以提供帮助。
-
保存以下的目标文件为
buildall.targets
在您的解决方案目录的根目录<项目ToolsVersion =4.0
的xmlns =http://schemas.microsoft.com/developer/msbuild/2003
DefaultTargets =默认> <&的ItemGroup GT;
< AllFiles包括= /&GT\\ ** \\ *。SLN。
< /&的ItemGroup GT; <目标名称=默认>
<项目的MSBuild =@(AllFiles)/>
< /目标> < /项目> -
创建一个名为批处理文件
BuildAll.cmd
与内容如下:(变更路径msbuild.exe取决于您使用.NET Framework版本)C:\\ WINDOWS \\ Microsoft.NET \\ Framework64 \\ v4.0.30319 \\的MSBuild buildall.targets
-
运行/执行
BuildAll.cmd
请参阅 MSDN:如何:选择文件来构建以递归文件夹的详细信息穿越,尤其是指定用输入通配符部分
I am an intern with a start-up company. I don't know anything about Batch files, XML files, the command prompt, or msbuild. I only know the basics of C#.
I have been asked to make a batch file that allows a user to build ALL solutions in a directory, with seven subfolders, in one command. I know how to build one solution in a single folder (by using msbuild mysolution.sln
), but to build many solutions from seven different folders is beyond me.
It is possible to make a batch file that allows msbuild to find all solution files in the subfolders and build them all at once?
Thanks in advance for anyone who can help.
Save following targets file as
buildall.targets
in the root of your solutions directory<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Default"> <ItemGroup> <AllFiles Include=".\**\*.sln"/> </ItemGroup> <Target Name="Default"> <MSBuild Projects="@(AllFiles)"/> </Target> </Project>
Create batch file named
BuildAll.cmd
with following content: (change path to msbuild.exe depends on .NET Framework version you are using)C:\Windows\Microsoft.NET\Framework64\v4.0.30319\msbuild buildall.targets
Run/execute
BuildAll.cmd
See MSDN: How to: Select the Files to Build for more details on recursive folder traversal, especially "Specifying Inputs with Wildcards" part
这篇关于我怎么可以一次使用一个批处理文件的MSBuild解决方案在多个目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!