Skip to content

Commit b943c83

Browse files
authored
Autodetect CI environment (#373)
- check for CI environment variables in build.cmd
1 parent 3e2e11b commit b943c83

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

.codeql.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ jobs:
4747
timeoutInMinutes: 90
4848

4949
steps:
50-
5150
- task: UseDotNet@2
5251
inputs:
5352
useGlobalJson: true
@@ -58,7 +57,7 @@ jobs:
5857
- script: .\build.cmd EnableSkipStrongNames
5958
displayName: Windows Build - EnableSkipStrongNames
6059

61-
- script: .\build.cmd Build /p:BuildPortable=true /p:Desktop=false
60+
- script: .\build.cmd Build /p:BuildPortable=true
6261
displayName: Windows Build
6362

6463
- task: CodeQL3000Finalize@0

azure-pipelines.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ jobs:
6565

6666
- script: .\build.cmd EnableSkipStrongNames
6767
displayName: Enable SkipStrongNames
68-
- script: .\build.cmd $(_BuildTarget) /p:Desktop=false /p:BuildPortable=true ^
68+
- script: .\build.cmd $(_BuildTarget) /p:BuildPortable=true ^
6969
/binaryLogger:artifacts/msbuild.binlog /p:Configuration=$(_Configuration) /p:StyleCopEnabled=$(_StyleCopEnabled) ^
7070
/fileLoggerParameters:LogFile=artifacts/msbuild.log;Summary;Verbosity=minimal
7171
displayName: Build

build.cmd

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,18 @@ if exist "%InstallDir%\MSBuild\15.0\Bin\MSBuild.exe" (
3838
goto BuildFail
3939
)
4040

41+
REM Are we running in a local dev environment (not on CI)?
42+
if DEFINED CI (set Desktop=false) else if DEFINED TEAMCITY_VERSION (set Desktop=false) else (set Desktop=true)
43+
4144
if "%1" == "" goto BuildDefaults
4245

43-
%MSBuild% Runtime.msbuild /m /nr:false /p:Platform="Any CPU" /p:Desktop=true /v:M ^
46+
%MSBuild% Runtime.msbuild /m /nr:false /p:Platform="Any CPU" /p:Desktop=%Desktop% /v:M ^
4447
/fl /fileLoggerParameters:LogFile=bin\msbuild.log;Verbosity=Normal /consoleLoggerParameters:Summary /t:%*
4548
if %ERRORLEVEL% neq 0 goto BuildFail
4649
goto BuildSuccess
4750

4851
:BuildDefaults
49-
%MSBuild% Runtime.msbuild /m /nr:false /p:Platform="Any CPU" /p:Desktop=true /v:M ^
52+
%MSBuild% Runtime.msbuild /m /nr:false /p:Platform="Any CPU" /p:Desktop=%Desktop% /v:M ^
5053
/fl /fileLoggerParameters:LogFile=bin\msbuild.log;Verbosity=Normal /consoleLoggerParameters:Summary
5154
if %ERRORLEVEL% neq 0 goto BuildFail
5255
goto BuildSuccess

0 commit comments

Comments
 (0)