You need to use double quotes for groovy to replace the variable in the
string.
bat "\"%ProgramFiles(x86)%\\MSbuild\\14.0\\bin\\MSBuild.exe\"
Tools\\MailboxRefill\\Mailbox.sln /property:Configuration=${buildconfiguration}
/target:Build /nologo /clp:ErrorsOnly /verbosity:minimal
/p:RunCodeAnalysis=false /p:WarningLevel=1"
String interpolation only works with double quoted strings.
On Thu, Dec 15, 2016 at 4:31 AM Yogesh Bhole <[email protected]> wrote:
> Problem here is command uses ${buildconfiguration} instead of value of
> buildconfiguration
> variable. How to solve this ?
>
>
> On Thursday, 15 December 2016 12:29:44 UTC+1, Yogesh Bhole wrote:
>
> Hello,
>
> I use bat command in Jenkins pipeline which launches MSBUild. But the
> parameter used namely "buildconfiguration" is not expanded. You may ignore
> error solution file not found. What I want to use the command executed the
> value of varibale "buildconfiguration"
>
> Anyone has a solution for this.
>
> Thanks in advance.
>
> Best Regards !
>
>
>
> Pipeline code
> ---------------
>
> def buildconfiguration = 'Debug'
>
> node('master')
> {
> stage('one')
> {
> bat '"%ProgramFiles(x86)%\\MSbuild\\14.0\\bin\\MSBuild.exe"
> Tools\\MailboxRefill\\Mailbox.sln
> /property:Configuration=${buildconfiguration} /target:Build /nologo
> /clp:ErrorsOnly /verbosity:minimal /p:RunCodeAnalysis=false
> /p:WarningLevel=1'
> }
>
> }
>
>
>
> Output
> ----------
> Started by user admin
> [Pipeline] node
> Running on master in D:\Software\Z-Tools\TestPipeline
> [Pipeline] {
> [Pipeline] stage
> [Pipeline] { (one)
> [Pipeline] bat
> [TestPipeline] Running batch script
>
> D:\Software\Z-Tools\TestPipeline>"C:\Program Files
> (x86)\MSbuild\14.0\bin\MSBuild.exe" Tools\MailboxRefill\Mailbox.sln
> /property:Configuration=${buildconfiguration} /target:Build /nologo
> /clp:ErrorsOnly /verbosity:minimal /p:RunCodeAnalysis=false
> /p:WarningLevel=1
> MSBUILD : error MSB1009: Project file does not exist.
> Switch: Tools\MailboxRefill\Mailbox.sln
> [Pipeline] }
> [Pipeline] // stage
> [Pipeline] }
> [Pipeline] // node
> [Pipeline] End of Pipeline
> ERROR: script returned exit code 1
> Finished: FAILURE
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-users/bc97e121-b76e-4a28-a409-c92ae3240310%40googlegroups.com
> <https://groups.google.com/d/msgid/jenkinsci-users/bc97e121-b76e-4a28-a409-c92ae3240310%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVd3ajoC_2GZ%3Dvyqo7VKosjBcSuN3EdDgjMg6o2TD8inKA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.