My runsettings file contains few connectionstrings which I want to be able to override in VSTS depending on the environment.
I don't want a specific runsettings file for each environment, but I want to use environment variables in order to be consistent on how our other deployment release are configured.
However I'm facing issue when I want to forward to my unit test a connectionstring (or any parameter) which include a semicolon (;). It's being truncated. I've tested transmitting other value without ";" successfully.
settings.runsettings
<?xml version="1.0" encoding="utf-8"?>
<RunSettings>
<TestRunParameters>
<Parameter name="CRM_CONNECTIONSTRING" value="Url = https://MYCRM.crm4.dynamics.com; [email protected]; Password=mypassword;" />
<TestRunParameters>
</RunSettings>
However, when exectuting (and displaying the actual value received in the unit test) the value is truncated after the first ";"
is there a way to protect the value ?
ending up to answer to myself with a workaround after contacting microsoft directly.
issue come up as well here on official vsts-task github: https://github.com/Microsoft/vsts-tasks/issues/2567
Workaround: before the test assembly task, run a powershell script taking path to runsettings file as parameter, reading VSTS environment variables and replace direcly XML values in runsettings.
I've provided my powershell script here : https://github.com/camous/vsts-powershell/blob/master/Set-RunSettings.ps1 (parameters have to be prefixed by "__")
and I wrote a more complete "how to" here: https://stuffandtacos.azurewebsites.net/2016/09/28/override-runsettings-parameters-in-visual-studio-team-service-when-value-contains-semi-colons/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With