I’ve got an msbuild project that tries to establish a global root directory thus:
<PropertyGroup>
<TheRoot>$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFile), theroot.txt))</TheRoot>
</PropertyGroup>
I use that to get custom build settings:
<Import Project="$(TheRoot)\build\TheBuild.settings" />
Sometimes (I repeat, sometimes) VS2010 claims it won’t load the project because it can’t find my imported TheBuild.settings. The path it reports suggests that it is not bothering to evaluate the property before it looks for the input.
MSBuild has no such difficulty.
I must stress that VS2010 has this problem only occasionally; there are some conditions where it processes it just fine. Sadly, I have been unable to determine what those conditions are.
Why can’t VS make sense of my property?
Edit: If I open a solution file successfully, and then close it, suddenly it works: that instance of VS can open any of these projects. Don’t know if that helps.
I’ve done this same thing with a rather complex build and it has never failed. The only difference between yours and mine is that I’m using $(MSBuildThisFileDirectory), and the “sentinal” file I’m using is the same file that will be imported, in your case “TheBuild.settings” instead of “theroot.txt” though I don’t see how that would matter.
Do you notice this at all when editing the files while a solution is open? Is your declaration of $(TheRoot) in the project file or in an imported file? This can make a difference as the IDE will cache imported property files.