Error in Substitute variables in files

Hi I am getting an error trying to do variable substitution.

Octopus server version: 2.4.9.167
Octopus tentacle version: 2.4.5.46

I set up the project so that:
Target Files has: clientHostSettings.config
Output file encoding: Detect from template

The file clientHostSettings.config has the following:

<?xml version="1.0" encoding="utf-8" ?>

When I deploy i get the following error:
Loading file ‘C:\OctopusTentacle\Applications\Stage\ImportDriver\14.07.1.999_6\clientHostSettings.config’ for Octopus variable substitution

Fatal 14:36:47
’’ is not a supported encoding name.
Parameter name: name
System.ArgumentException: ‘’ is not a supported encoding name.
Parameter name: name
at System.Globalization.EncodingTable.internalGetCodePageFromName(String name)
at System.Globalization.EncodingTable.GetCodePageFromName(String name)
at Octopus.Tentacle.Procedures.Implementations.Template.OctopusTemplateTransformProcedure.Start(IProcedureHost host, ProcedureState state) in y:\work\refs\heads\master\source\Octopus.Tentacle\Procedures\Implementations\Template\OctopusTemplateTransformProcedure.cs:line 38
at Octopus.Tentacle.Orchestration.Procedures.ProcedureCallOrchestrator.Receive(CallProcedureCommand message) in y:\work\refs\heads\master\source\Octopus.Tentacle\Orchestration\Procedures\ProcedureCallOrchestrator.cs:line 73
at Pipefish.Actor.OnReceivingTyped[TBody](Message message) in y:\work\3cbe05672d69a231\source\Pipefish\Actor.cs:line 113

Hi,

Thank you for the report. It seems that the empty encoding specified for the substitution step has resulted in an empty string coming through rather than null.

You should be able to work around this by specifying utf-8 or an equivalent (http://msdn.microsoft.com/en-us/library/system.text.encoding.aspx) as the encoding value.

I’ve raised an issue so we can fix this: https://github.com/OctopusDeploy/Issues/issues/1052

Regards,
Nick

Yes, the workaround worked by specifying the encoding on the configuration section. Hope it gets fixed.

Now I find that #{Octopus.Machine.Name} is not getting replaced in the clientHostSettings.config file.

Any ideas?

Thanks for the follow up; it’s fixed in 2.5.3+.

I’m not sure what might be causing the substitution to not happen - what is the actual output (just a blank, or the token still in there?)

If the token’s still in there and the file substitution is being listed in the deployment log, it’s likely there’s a syntax error (or something the parser can’t handle) in the file.

Can you please provide:

  • The relevant lines from the Raw task log
  • Either the complete file being transformed, or a minimal version of it that still exhibits the error?

Thanks again for the info!

Regards,
Nick

I figured it out. The deploy was not updating the package because the option to always update the package in Octopus was not checked by default.

All working now. Thanks !