I have a very simple file on which I’m applying the “Substitute variables in files”. This was created manually using Notepad++ (UTF-8). With “Show all symbols” enabled in Notepad++, it looks like this:
where CRLF are the end of line characters.
However, when the file is processed by Octopus and “Substitute variables in files” is applied, the encoding is still UTF-8 but it looks like this:
Notice that the CR is missing.
II don’t think this would be an issue if the file were to be consumed by a .NET application or Powershell, but unfortunately it is to be consumed by an Excel VBA piece of code, which doesn’t detect the line break without the CR in it.
Why is “Substitute variables in files” changing those characters which are not part of the variable substition? Is there a way to get it to not do it?
Thanks for reaching out! Could you follow the below instructions and send me a deployment log so I can check what’s going on?
If possible, also send me a copy of your file-to-be-substituted before the substitution (just like it is in the package before deployment).
Your hint led me to check the NuGet package, and sure enough, the file is missing the CR in there. I assumed it was Octopus because it’s the visible part but it must be either TeamCity or NuGet.
I’ll update once I find out and solve the problem just in case other people get here.
Thanks for your help,
It turned out to be TeamCity and the way it handles enf of line Git settings, ignoring the autocrlf option:
In the end I had to work around it in Excel, manually parsing LF as end of line.
Apologies for raising a ticket that is not directly related to Octopus, but hopefully it helps other people.
Glad to hear you found a solution! Thanks for posting it back here for reference to other users.