.NET Framework Developer Center > .NET Development Forums > MSBuild > Quickly automate builds recursively?
Ask a questionAsk a question
 

AnswerQuickly automate builds recursively?

  • Wednesday, February 13, 2008 12:00 AMDaveHorner Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hello!

    I'd like to build all of the .sln files contained within a directory tree.

    I tried running:

                ProcessStartInfo oStartInfo = new ProcessStartInfo();
                oStartInfo.FileName = devenvPath;
                oStartInfo.Arguments = " /build Debug " + solutionPath;
                Process.Start(oStartInfo);

    But this doesn't work...thinking it is the env. not being setup correctly...
    I don't know how to run the vcvars.bat files and then build from a Process.Start.
    Of course, UAC is a problem with making it silent...

    Is there some better way to be doing this....
    Do I create MSBUILD scripts?  Automate VS with macros? Use CRUISECONTROL.NET or something?
    What is the suggested way to quickly start automating builds using msbuild?


    --Dave
    http://dave.thehorners.com/

Answers

  • Wednesday, February 13, 2008 7:53 PMSteveO.uts Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    You can create an msbuild project file that uses an item group to select all of the solution files recursively from a specified directory.

     

    Code Snippet

    <ItemGroup>

      <SolutionReferences Include="**\*.sln"/>

    </ItemGroup>

     

    <Target Name="BuildAll">

      <MSBuild Projects="@(SolutionReferences)" ... />

    </Target>

     

     

     

    You can then use msbuild to call the project file passing the BuildAll target - you can create a batch file to do this and have it call vcvars.bat before hand . . .

All Replies

  • Wednesday, February 13, 2008 7:53 PMSteveO.uts Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    You can create an msbuild project file that uses an item group to select all of the solution files recursively from a specified directory.

     

    Code Snippet

    <ItemGroup>

      <SolutionReferences Include="**\*.sln"/>

    </ItemGroup>

     

    <Target Name="BuildAll">

      <MSBuild Projects="@(SolutionReferences)" ... />

    </Target>

     

     

     

    You can then use msbuild to call the project file passing the BuildAll target - you can create a batch file to do this and have it call vcvars.bat before hand . . .

  • Sunday, November 01, 2009 2:23 PMcapt edgar Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    is there any template or anything on how the above mentioned batch file can be written. sorry trying to find a quick solution to a fix