how to add a configuration parameter with spaces on Jenkins

28 views
Skip to first unread message

Jesus Fernandez

unread,
Nov 6, 2020, 9:06:47 AM11/6/20
to Jenkins Users
I have a pipeline which builds a C++ project for that I am using MSBuild, untill now we were using the "Final" configuration parameter, but now I need to switch it to "Release Steam D3D11", when I try to do that I get an error on Jenkins when building the project I guess it is because of the spaces, how can I make Jenkins to take this parameter? this is what I have tried:

```
stage('Build'){
            steps{
                script {
                    def msbuild = tool name: 'MSBuild', type: 'hudson.plugins.msbuild.MsBuildInstallation'
                    bat "\"${msbuild}\" AoC/Source/project-GRDK.sln /t:Rebuild /p:configuration=Release Steam D3D11" 
                } 
            }
        }
```

I have also tried adding ' ' to the configuration name such as : 
```
bat "\"${msbuild}\" AoC/Source/project-GRDK.sln /t:Rebuild /p:configuration='Release Steam D3D11'" 
```
but it does not work neither

Victor Martinez

unread,
Nov 6, 2020, 9:55:26 AM11/6/20
to Jenkins Users
Did you try with escaped double quotes?  Something like:

  • bat "\"${msbuild}\" AoC/Source/project-GRDK.sln /t:Rebuild /p:configuration=\"Release Steam D3D11\" " 

You can also use the multilne approach to avoid the escape of double quotes:

  • bat """ "${msbuild}" AoC/Source/project-GRDK.sln /t:Rebuild /p:configuration="Release Steam D3D11" """ 


jesus fernandez

unread,
Nov 10, 2020, 6:45:18 AM11/10/20
to Jenkins Users
that worked! thanks!
Reply all
Reply to author
Forward
0 new messages