I have a project that has a post-build event that xcopies a DLLs to a certain directory:
xcopy \"$(TargetDir)$(TargetName).dll\" \"$(SolutionDir)..\\UdpLocationS
I just ran into the same problem with TeamCity.
The issue here is the $(SolutionDir) property in your build file. You haven't defined it in your call to MsBuild (this is why you see the word undefined in your output).
Call msbuild with the property set, like this:
msbuild myproject.csproj /property:SolutionDir="solution directory"\
Where "solution directory" is the directory containing your solution file. Note the trailing slash, you'll need that to make sure the path is correctly formed.