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.








Post a Comment