0

i am trying to pass a System.Environment.GetEnvironmentVariable("String") from Jenkins to my app.config file and im getting a 'missing Whitespace' error. I think its because im calling a string within a string? I can't seem to find a way to escape it however

<add key="Env_Custom-TestUrl" value="System.Environment.GetEnvironmentVariable("BaseURL")" />

Anyone any ideas?

Thanks

Kyle
  • 133
  • 7
  • Check if variable exists using cmd.exe >SET SET will give a list of all variables. – jdweng Jul 21 '22 at 11:26
  • Regardless whether it exists or not, if the syntax isn't right it won't be able to access it. Its a Jenkins variable so not available in the environment – Kyle Jul 21 '22 at 11:42
  • GetEnvironmentVariable() will only work if it is a windows variable. So it needs to be seen in cmd.exe. – jdweng Jul 21 '22 at 12:18
  • It does work if you assign GetEnvironmentVariable() to a variable and call that. That is my workaround – Kyle Jul 21 '22 at 13:14
  • Read you comment again start with "Regardless". You said "exist or not". – jdweng Jul 21 '22 at 13:32
  • https://stackoverflow.com/questions/1222367/escape-double-quote-character-in-xml – Hans Passant Jul 21 '22 at 16:14

0 Answers0