I believe the problem is documented here moved here and looks like it might be a bug in visual studio, but I\'m wondering if anyone knows of a workaround.>
Allan's answer is exactly on the right path, but if you want to move to parent directory of the ProjectDir, or the $(ProjectDir)..\ output is going to be a string, you need to perform the 'go to parent directory' operation in msbuild.
Here is how you can achieve this:
$([System.IO.Path]::GetDirectoryName($(ProjectDir)))
This code will set the parent directory path of the ProjectDir to TrimmedDir variable. [System.IO.Path]::GetDirectoryName() performs this operation.