Asked by:
MSDeploy not replacing encoded xml strings

Question
-
User726754636 posted
I was redirected here from https://social.msdn.microsoft.com/Forums/en-US/472218ac-9959-4b87-81f0-a1fe83448c64/msdeploy-not-replacing-encoded-xml-strings?forum=msbuild
In web.config I have:
<applicationSettings> <App.Properties.Settings> <setting name="ProfitConnectorToken" serializeAs="String" xdt:Transform="Replace" xdt:Locator="Match(name)"> <value>__ProfitConnectorToken__</value> </setting> </App.Properties.Settings> </applicationSettings>
In my parameters.xml:
<parameter name="ProfitConnectorToken" description="Description for ProfitConnectorToken" defaultvalue="__PROFITCONNECTORTOKEN__" tags=""> <parameterentry kind="XmlFile" scope="\\web.config$" match="/configuration/applicationSettings/App.Properties.Settings/setting[@name='ProfitConnectorToken']/value/text()" /> </parameter>
And in my SetParameters.xml:
<setParameter name="ProfitConnectorToken" value="<token><version>1</version><data>XXXXXXXXXXXXXXXXXXXXXXXXX</data></token>" />
But this value is not set when the web application is deployed. When I change my SetParameters.xml to:
<setParameter name="ProfitConnectorToken" value="TEST" />
It does work, so my XPath is correct. Why is the encoded xml value not set?
Friday, June 9, 2017 9:37 AM
All replies
-
User1967761114 posted
Hi David1656145,
According to your description, that seems like couldn’t upload the changed files.
For MSDeploy, the minimal unit is file, not file content, MSDeploy is not notice the contents of the document, only notice the file itself whether has been modified.
So in your case, I suggest you could try it again to confirm this issue, when using MSDeploy, you could preview the changes of this time in the feature of preview.’
For more details about using MSDeploy, you could refer to the following link.
If you have any other questions, please feel free to contact me any time.
Best Regards
Even
Monday, June 12, 2017 5:47 AM -
User726754636 posted
Hi,
It is working because when I put in the value "TEST" it works and I see this value in the deployed web application. When I put in the encoded xml string it doesn't work, the value in the deployed web application remains the default value.
Monday, June 12, 2017 8:29 AM -
User1967761114 posted
Hi David1656145,
After I searched about this issue on internet, that’s might a BUG.
See the following link, that’s similar as yours, and a microsoft employee said will fix that in an upcoming release.
If you have any other questions, please feel free to contact me any time.
Best Regards
Even
Tuesday, June 13, 2017 7:54 AM -
User-745244032 posted
have you tried putting the XML in a separate file?
encoded xml in webconfig is always painful and there are pros/cons to this approach, but might be worth a shot...?
https://blogs.iis.net/elliotth/web-deploy-xml-file-parameterization
Thursday, July 6, 2017 7:45 PM