nuget-webtargets icon indicating copy to clipboard operation
nuget-webtargets copied to clipboard

Escaped characters producing unexpected results

Open brinko99 opened this issue 6 years ago • 0 comments

I find that with certain XML escaped characters existing in my App.config, the transform results in the unescaped character in the resulting exe.config file. Find an example repo project here.

For example, this line in App.config: <variable name="exceptionHeader" value="${newline}${newline}Exception Detail&#xFF1A;${newline}" />

Results in this line within the exe.config: <variable name="exceptionHeader" value="${newline}${newline}Exception Detail:${newline}" />

Note the conversion of &#xFF1A; to :.

This results in errors when trying to parse the data from the exe.config. The above is an example of an NLog configuration. NLog has issues with colons (apparently even the fixed width colon), the escaped values are necessary.

Additionally newlines within an attribute are stripped. For example:

<variable name="exceptionDetail"
          value="${exception: format=${exceptionFormat}: separator=&#xD;&#xA;: innerFormat=${exceptionFormat}:
                              innerExceptionSeparator=&#xD;&#xA;&#xD;&#xA;Inner Exception&#xFF1A;&#xD;&#xA;}" />

becomes:

<variable name="exceptionDetail"
          value="${exception: format=${exceptionFormat}: separator=&#xD;&#xA;: innerFormat=${exceptionFormat}:&#xD;&#xA;                                  innerExceptionSeparator=&#xD;&#xA;&#xD;&#xA;Inner Exception:&#xD;&#xA;}" />

Note the newline disappears.

Any help in this area is appreciated. Great tool; keep up the good work!

brinko99 avatar May 02 '19 00:05 brinko99