I'm working on C# project using Gitlab CI and would like to hide secrets in app.config file.
I added one variable in Gitlab and in app.config like this:
<add key="User" value="username" />
<add key="Password" value=$Password />
Then, when i try to build application in gitlab CI using msbuild, i receive an error:
$ msbuild "$PROJECTNAME.sln" /consoleloggerparameters:ErrorsOnly /t:Test_project /maxcpucount /nologo /property:Configuration=Release /verbosity:quiet app.config(5,33): error MSB3249: Application Configuration file "app.config" is invalid. '$' is an unexpected token. The expected token is '"' or '''. Line 7, position 33. [/builds/project/Test_project/Test_project.Service/Test_project.Service.csproj]
Please advice, how to add Gitlab environment variable in app.config xml file.
<add key="Password" value="$Password" />cat ./Test_project.Service/bin/Release/Test_project.Service.exe.config ...<add key="Password" value="$Password" />...echo $Password password$it would seem it's not being replaced at all.value="%Password%"?<add key="Password" value="%Password%" />