You're already using it: Condition
. You just have to extract an extra step to create a property that will be used as the TEAMBUILD value. For example:
<PropertyGroup Condition='$(BuildingInsideVisualStudio)' != 'true' ">
<TeamBuildValue>FALSE</TeamBuildValue>
</PropertyGroup>
<PropertyGroup Condition='$(BuildingInsideVisualStudio)' == 'true' ">
<TeamBuildValue>TRUE</TeamBuildValue>
</PropertyGroup>
<PropertyGroup>
<PreBuildEvent>
</PreBuildEvent>
<PostBuildEvent>
...
set TEAMBUILD=$(TeamBuildValue)
...
</PostBuildEvent>
</PropertyGroup>