1
Vote

PreserveWhitespace does not preserve whitespace within an element

description

If you have the following config:
<applicationSettings>
  <BokaNet.TelliQDrivingLog.Properties.Settings>
    <setting name="BokaApiUrl" serializeAs="String">
      <value>http://localhost:52140/api/</value>
    </setting>
    <setting name="CustomerId" serializeAs="String">
      <value>demo</value>
    </setting>
  </BokaNet.TelliQDrivingLog.Properties.Settings>
</applicationSettings>
and a transform:
<applicationSettings>
  <BokaNet.TelliQDrivingLog.Properties.Settings>
    <setting name="BokaApiUrl" serializeAs="String" xdt:Transform="Replace" xdt:Locator="Match(name)">
      <value>http://foo.bar/api/</value>
    </setting>
    <setting name="CustomerId" serializeAs="String" xdt:Transform="Replace" xdt:Locator="Match(name)">
      <value>demo</value>
    </setting>
  </BokaNet.TelliQDrivingLog.Properties.Settings>
</applicationSettings>
That you transform with the option preservewhitespace the resulting config does not have whitespaces within the setting-element.
Image

comments

outcoldman wrote Apr 8, 2016 at 12:29 PM

I don't believe that library (https://xdt.codeplex.com), which we are using allows you to set PreserveWhitespace in XmlTransformation class.
If you really want this to be fixed - open a bug on them first, or you can send PR to their library + our project.