get parent directory in MSBuild

I'm assuming that this is MSBuild 4.0. You can do this:

<PropertyGroup>
     <RootFolder>$([System.IO.Path]::GetDirectoryName($(MSBuildProjectDirectory)))</RootFolder>
</PropertyGroup>
<Message Text="RootFolder: '$(RootFolder)'" />

The question you posted has your answer, and it looks to be a decent one. MSBuild is built around projects and not solutions, so finding something to give you a solution path requires a bit of customization. One fact to consider is that for many projects solution files aren't located at the root of the project tree (or 'cone' in MSBuild parlance).

MSBuild Reserved Properties

Tags:

.Net

Msbuild

Nant