How can I use a batch file to MSBuild solutions in multiple directories at once?

后端 未结 1 1708
深忆病人
深忆病人 2021-01-06 14:34

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 bee

相关标签:
1条回答
  • 2021-01-06 15:24
    1. 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>
      
    2. 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
      
    3. 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

    0 讨论(0)
提交回复
热议问题