XML variable substitution - handling special characters problem
See original GitHub issueXML variable substitution - handling special characters problem
When I use IIS Web App Deploy (Deployment Groups) and XML variable substitution to modify the web.config file I see that the string in the output file is different from the input. In my case I have this connectionstring that I specify under Variables when creating a new Release definition. The connectionstring should be updated in the web.config in the deployed web app:
Data Source=xxxx-xxxxx;Initial Catalog=xxxxxxxx;User Id=xxxxxxUser; password=‘E~FU:5&?77WY3wRU#:’
but this is changed to
Data Source=xxxx-xxxxx;Initial Catalog=xxxxxxxx;User Id=xxxxxxUser; password='E~FU:5&?77WY3wRU#:'
So it seams like this feature is not able to handle special characters?
also when I test the same string that you have inside vsts-tasks/Tasks/Common/webdeployment-common/Tests/L1XmlVarSub.ts
This string: Url=https://primary;Database=db1;ApiKey=11111111-1111-1111-1111-111111111111;Failover = {Url:‘https://secondary’, ApiKey:‘11111111-1111-1111-1111-111111111111’}
is changed to:
Url=https://primary;Database=db1;ApiKey=11111111-1111-1111-1111-111111111111;Failover = {Url:'https://secondary', ApiKey:'11111111-1111-1111-1111-111111111111'}
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:14 (6 by maintainers)
I think this is a wrong advice, because it moves the responsibility of transforming the data into variable container. For example, what if the content of the variable is going to be used both in JSON and XML? The content should be correct and should be adjusted/escaped based on the target file type. This is something that is implicit when working with XMLs.
@MichalKoscielniak , ideally there should be no alteration made to the variable value set by the user. This was a bug and we fixed it. This caused the regression in your case. Please change your variable value to required value (
MY_DB_DATA&ssl=true
)