Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to build dependent project first with msbuild

I have just started looking into msbuild, because I want to make my own build scripts. For now I am able to create build scripts that compiles only one project, but how do I handle dependencies?

For example what if I have two projects that gets build with these two msbuild scripts?

  1. projectA.xml
  2. projectB.xml

How do I tell msbuild that when I am executing projectB.xml that it should first execute projectA.xml?

I have googled alot on this, but it does not seem to get anything that a starter like me understands. I would be more than happy with a link to an article describing this, or maybe just a small code example.

The reason why I want this control is because of a library I am building. The library consists of several projects. A developer should be able to pull the source code for the library down and build only the libraries that he wants.

Actually I want to be able to build .net modules from the different projects. That is why I want to be able to run a customized msbuild script.

like image 408
mslot Avatar asked Mar 15 '12 22:03

mslot


1 Answers

If you create a solution with the two projects you can target the .sln file with msbuild, rather than directly building the projects, it should take care of project dependencies :)

But that's if you're using standard .csproj projects...

Ok I looked at a project I'm working on, and it's like this:

<ItemGroup>
   <ProjectReference Include="..\SomeFolder\SomeProject.csproj">
      <Project>{1A94B405-2D01-4A09-90D5-A5B31180A03B}</Project>
      <Name>SomeProjectNamespace</Name>
   </ProjectReference>
</ItemGroup>

And here's an MSDN page about references. Scroll down till you find ProjectReference...

like image 58
joshuahealy Avatar answered Sep 30 '22 20:09

joshuahealy