MSBuild Task: Solution and Project dependencies
Few months ago I needed to use MSbuild to build solution. Sounds simple right? Yeah, but not quite.
Somehow, my msbuild failed with project dependency issues. It turns out that MSBuild doesn’t respect project dependencies in a solution. Google “msbuild solution dependencies” and you’ll find various post complaining about the problem with MSBuild.
I modified the MSBuild task found here to get projects in a solution file in dependency order.
You can then call the task to get the projects and compile them in order:
<Target Name="BuildProjects"> <GetProjecsInOrder Solution="$(MSBuildProjectDirectory)\MySolution.sln"> <Output ItemName="ProjectFiles" TaskParameter="Output"/> </GetProjecsInOrder> <MSBuild Projects="%(ProjectFiles.FullPath)" Targets="Build" Properties="Configuration=Release"/> </Target>
You can download the modified source from http://www.esnips.com/doc/8e232db4-21ac-4d93-90dc-2a8bc4db34a8/MSBuildTasks