NewLine in variable does not create a newline when substituted into a file

I have a multi line variable, but when it gets put replaced into a file during deployment the newlines are removed. Attached shows how variable is defined, how it shows in Release Variable list, and final file replacement. How can I get a multi-line variable to be substituted into a file?

Thanks!

Dave

OctopusNewLineProblem.png

Hi Dave,

Thanks for getting in touch.

Using the latest version of Octopus (3.3.21) we were not able to reproduce this problem with a small powershell script and a multiline project or library variable (we tried executing this script on both the Tentacle and the server and both were successful). For example, this resulted in multiple lines of text to correctly be output to a debug.txt file on the server:

$myMultilineVar = "#{MyMultilineVar}"
$myMultilineVar | Out-File c:\debug.txt

Can you please confirm which version of Octopus you are using and how you are using this variable substitution exactly (please include screenshots or code showing how you are using the variable to be substituted into a file) and we’ll see if we can get to the bottom of this for you :slight_smile:

Newlines will not be shown in the release variables list (newlines will be stripped because they’re not recognised as HTML), but if you inspect the variable element (Right click > Inspect if you are using Google Chrome) you will be able to see the raw value, which should show your newlines. Can you confirm if this raw value does have the newlines removed?

Cheers
Mark Siedle