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

后端 未结 4 1284
情话喂你
情话喂你 2021-02-05 01:36

Are the any MSBuild properties that Visual Studio sets? I\'m looking to have some conditional behavior depending on the version (if any) of visual studio.

4条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-05 02:29

    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.

    
        Foo  
        Bar 
    
    

提交回复
热议问题