-
Bug
-
Resolution: Fixed
-
Minor
In Jenkins->Global Tool Configuration->MSBUILD
I Added a MSBUILD like below
Name: MSBuildTool2017
Path to MSBuild: C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe
Variable ${tool 'MSBuildTool2017'} can be recognized in one-line batch script but not in the multi-line script, Why?
Is there any way I can void the hardcoded MSBUILd Tool Path in the batch script of Jenkins pipeline script?
def buildSource() { //${tool 'MSBuildTool2017'} is recognized.
bat "\"${tool 'MSBuildTool2017'}\" ABC.sln /p:Configuration=Release /p:Platform=\"x64\" /t:rebuild"
}
def BuildABC() { //${tool 'MSBuildTool2017'} is not recognized.
{
bat label: '', script: '''@echo off
set RETVAL=0
echo Navigating to ABC folder
cd %WORKSPACE%
cd project
echo Cleaning up bin folder
REM del bin_x64
*.exe /F /Q /S
REM if NOT "%errorlevel%" == "0" set RETVAL=%errorlevel%
echo Navigating to InstallActionsolution folder
cd ABC
echo Building ABC Binaries
\"${tool 'MSBuildTool2017'}\" "ABC.sln" /p:Configuration=Release /p:Platform=\"x64\" /t:rebuild
if NOT "%errorlevel%" == "0" set RETVAL=%errorlevel%
exit %RETVAL%'''
}
[JENKINS-57596] Problem using MSBuild Tool name in multi-line batch file in Pipeline script
Description |
Original:
In Jenkins->Global Tool Configuration->MSBUILD I Added a MSBUILD like below Name: MSBuildTool2017 Path to MSBuild: C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe Variable ${tool 'MSBuildTool2017'} can be recognized in one-line batch script but not in the multi-line script, Why? Is there any way I can void the hardcoded MSBUILd Tool Path in the batch script of Jenkins pipeline script? def buildSource() \{ //${tool 'MSBuildTool2017'} is recognized. {{bat "\"${tool 'MSBuildTool2017'}\" ABC.sln /p:Configuration=Release /p:Platform=\"x64\" /t:rebuild"}} } def BuildABC() \{ //${tool 'MSBuildTool2017'} is not recognized. {{bat label: '', script: '''@echo off set RETVAL=0 echo Navigating to ABC folder cd %WORKSPACE% cd project echo Cleaning up bin folder REM del bin_x64\\*.exe /F /Q /S REM if NOT "%errorlevel%" == "0" set RETVAL=%errorlevel% echo Navigating to InstallActionsolution folder cd ABC echo Building ABC Binaries \"${tool 'MSBuildTool2017'}\" "ABC.sln" /p:Configuration=Release /p:Platform=\"x64\" /t:rebuild if NOT "%errorlevel%" == "0" set RETVAL=%errorlevel% exit %RETVAL%'''}} } |
New:
In Jenkins->Global Tool Configuration->MSBUILD I Added a MSBUILD like below Name: MSBuildTool2017 Path to MSBuild: C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe Variable ${tool 'MSBuildTool2017'} can be recognized in one-line batch script but not in the multi-line script, Why? Is there any way I can void the hardcoded MSBUILd Tool Path in the batch script of Jenkins pipeline script? def buildSource() \{ //${tool 'MSBuildTool2017'} is recognized. {{bat "\"${tool 'MSBuildTool2017'}\" ABC.sln /p:Configuration=Release /p:Platform=\"x64\" /t:rebuild"}} } def BuildABC() \{ //${tool 'MSBuildTool2017'} is not recognized. { bat label: '', script: '''@echo off set RETVAL=0 echo Navigating to ABC folder cd %WORKSPACE% cd project echo Cleaning up bin folder REM del bin_x64 *.exe /F /Q /S REM if NOT "%errorlevel%" == "0" set RETVAL=%errorlevel% echo Navigating to InstallActionsolution folder cd ABC echo Building ABC Binaries \"${tool 'MSBuildTool2017'}\" "ABC.sln" /p:Configuration=Release /p:Platform=\"x64\" /t:rebuild if NOT "%errorlevel%" == "0" set RETVAL=%errorlevel% exit %RETVAL%''' } |
Status | Original: Open [ 1 ] | New: In Progress [ 3 ] |
Resolution | New: Fixed [ 1 ] | |
Status | Original: In Progress [ 3 ] | New: Resolved [ 5 ] |