tag:help.appveyor.com,2012-11-13:/discussions/problems/27475-reading-mulltiline-xml-tag-to-variable-does-not-workAppVeyor: Discussion 2020-06-05T23:14:20Ztag:help.appveyor.com,2012-11-13:Comment/483790042020-06-03T03:45:00Z2020-06-03T03:45:00ZReading mulltiline XML tag to variable does not work<div><p>The code looks good to me. Try to output <code>$env:releaseNotes</code> in <code>before_deploy</code>?</p></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/483790042020-06-03T13:03:26Z2020-06-03T13:03:26ZReading mulltiline XML tag to variable does not work<div><p>Did it, same bahavior.</p>
<p>When XML tag PackageReleaseNotes is single line it is displayed correctly:<br>
<a href="https://ci.appveyor.com/project/alexmurari/repositive/builds/33291117#L33">https://ci.appveyor.com/project/alexmurari/repositive/builds/332911...</a></p>
<p>But when the tag is multiline, nothing is displayed (like if the variable is null):<br>
<a href="https://ci.appveyor.com/project/alexmurari/repositive/builds/33291146#L32">https://ci.appveyor.com/project/alexmurari/repositive/builds/332911...</a></p>
<p>So XML tags with multiline values are really a problem.</p></div>murarialextag:help.appveyor.com,2012-11-13:Comment/483790042020-06-03T17:03:58Z2020-06-03T17:03:58ZReading mulltiline XML tag to variable does not work<div><p>OK, now I see what you mean, thanks for additional info!</p>
<p>Right, environment variables cannot contain new line characters, therefore the following should work in all cases:</p>
<pre>
<code>$env:releaseNotes = $props.PackageReleaseNotes.Trim()</code>
</pre></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/483790042020-06-03T18:56:13Z2020-06-03T18:57:08ZReading mulltiline XML tag to variable does not work<div><p>Thanks for the response!</p>
<p>It works, but only the first line is preserved.</p>
<p>If I have something like this:</p>
<pre>
<code><PackageReleaseNotes>
- Alpha release.
- Changed Foo
- Fixed Bar.
</PackageReleaseNotes></code>
</pre>
<p>The variable only has "-Alpha Release".</p>
<p>There is any way of preserving the full content? It would be really powerful to pass this information to the deploy phase so you could create releases with filled descriptions automatically. Just a wild guess: it supports things like "HTML style line-breaks (br)" or "\n" or something like that to preserve content and line break?</p></div>murarialextag:help.appveyor.com,2012-11-13:Comment/483790042020-06-03T19:04:44Z2020-06-03T19:04:44ZReading mulltiline XML tag to variable does not work<div><p>You are right! <code>description</code> supports <code>\n</code> in it that will be replaced with the a real LF during the deployment. You need this:</p>
<pre>
<code>$env:releaseNotes = $props.PackageReleaseNotes.Trim().Replace("`n", '\n')</code>
</pre></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/483790042020-06-03T22:52:07Z2020-06-03T22:52:57ZReading mulltiline XML tag to variable does not work<div><p>Thanks, it works!!</p>
<p>Only thing is that I can't keep the value inside the tag indented, as the indentation whitespaces are misunderstood and all values ends up with leading whitespaces. But that's a PowerShell limitation and the solution is refrain from indenting the values. No problem at all.</p>
<pre>
<code><Project>
<PropertyGroup>
<PackageReleaseNotes>
- Alpha release.
- Foo
- Bar
</PackageReleaseNotes>
</PropertyGroup>
</Project></code>
</pre>
<p>Thanks a lot!</p></div>murarialextag:help.appveyor.com,2012-11-13:Comment/483790042020-06-04T05:49:47Z2020-06-04T05:49:47ZReading mulltiline XML tag to variable does not work<div><p>You can have as complex PS logic processing the contents of that element as you need.</p></div>Feodor Fitsner