In MSBuild is it possible to determine if I'm running in Visual Studio

The property value you should be using is BuildingInsideVisualStudio, when you are building inside of Visual Studio this property will be set to true. Since ProductVersion is declared in the project file you cannot use it because it will have the same value whether building inside of VS or via msbuild.exe.

<PropertyGroup>
    <MyProp Condition=" '$(BuildingInsideVisualStudio)' == 'true' ">Foo</MyProp>  
    <MyProp Condition=" '$(BuildingInsideVisualStudio)' != 'true' ">Bar</MyProp> 
</PropertyGroup>