4
votes

I'm struggling to find a solution for this issue.

I have a solution (VS2008) that contains around 50 projects (C#).

The inter-project dependencies are added as project-reference (and not by referncing a DLL).

Also, the dependencies inside VS is set correctly in the solution settings dialog.

The problem is, when building the solution from MSBUILD (command line) on our CI server, msbuild will build the projects in what seems to be the order that they're laid out in the solution file, and not according to the dependencies.

I've found numerous references for this on the web, with no solution...

What can i do in order to build the solution correctly with msbuild from command line ?

1
Can you verify that the inter-project references are configured at the project level (Project|Add Reference…) and not at solution level (Project|Project Dependencies…). In your .csproj files referencing other projects there should be a <ProjectReference> item for each referenced project. - Thomas Gerstendörfer
I have resolved the issue. I removed the references to the dependent project and re-added it. It appears that the GUID was somewhat different, i have no idea how. I guess when building from VS, there is no issue, but when using MSBuild, it fails to detect the project being referenced and fails to construct the correct dependency order. - lysergic-acid
check out the MSBUild team blog at bit.ly/depfail that discusses the perils of using solution dependencies - Brian Kretzler

1 Answers

1
votes

This can be due an invalid build order inside your solution. You can change the build order without removing and re-adding the project. In Solution Explorer, right-click the solution name and select Project Build Order. You will be able to specify the build order of your projects so it should work in msbuild. This commonly happens if inside VS you have cached the DLL's during development. To verify if it works, remove all obj and bin folders before changing the build order and running the build.