Skip to content

“Project Dependencies” of Visual Studio 2008 broken in MSBuild


Google Buzz

Just dealt with another Visual Studio 2008 “feature”.

You can specify all the necessary “Project Dependencies” in Visual Studio, but will get “CSC : error CS0006: Metadata file FooBar.dll could not be found“. Even if your csproj files have correct references to other solution projects, msbuild will fail.
Maybe it appears only if project output path is outside of project directory.

It appears that Visual Studio keeps the dependencies in two ways, only one of which is read by MSBuild. I see that because I still can specify dependencies in GUI, copy solution to other machine and build it with VS in correct order.

Not with MSBuild.

The data needed by MSBuild is a “ProjectSection(ProjectDependencies) = postProject” section of SLN file. Like this:

Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_versioninfo", "make_versioninfo.vcproj", "{F0E0541E-F17D-430B-97C4-93ADF0DD284E}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pythoncore", "pythoncore.vcproj", "{CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}"
	ProjectSection(ProjectDependencies) = postProject
		{F0E0541E-F17D-430B-97C4-93ADF0DD284E} = {F0E0541E-F17D-430B-97C4-93ADF0DD284E}
	EndProjectSection
EndProject

Note where to take the GUID of a referenced project.
If you create this section by hand, your project will build.

Not too much fun, if you have over 20 projects, where you can have up to 190 project dependencies… Have fun.

5 Comments

  1. Stephane wrote:

    Thanks for the post – it helped me out
    - what a !@#$ mess !!

    Posted on 08-Jan-09 at 1:41 | Permalink
  2. Doug wrote:

    Unfortunately, this does not seem to work with my MSBuild.
    vs2008, sp1

    Posted on 09-Jan-09 at 17:34 | Permalink
  3. Doug,
    This might be tricky. Check if you’re using right GUIDs in right order (in the line with “} = {“), and that you caught all necessary dependencies.
    My MSBuild is of the same version.

    Posted on 09-Jan-09 at 17:47 | Permalink
  4. Alexey wrote:

    ?????, ??? ?????????, ???????! :)

    Posted on 15-Feb-10 at 18:30 | Permalink
  5. Alexey wrote:

    I mean, chuvak, eto genialno, spasibo!

    Posted on 15-Feb-10 at 18:31 | Permalink

Post a Comment

Your email is never published nor shared.

Powered by WP Hashcash