We use TFS 2010.
There are a couple of projects with deployment steps which must know whether they are running on a dev machine or on the TFS build agent.
Right
When calling MSBuild from the command line, you can pass/overwrite properties like this:
# Simulate Visual Studio build
. msbuild.exe Project.csproj /p:BuildingInsideVisualStudio=true [...]
# Custom property
. msbuild.exe Project.csproj /p:MyCustomProperty=true [...]
Is use these to check them in my post/afterbuild events.