Octopus Server 2020.4.6
I’m attempting to use the structured variable replacement feature to replace parts of an XML file, but it keeps trying to read the file as JSON
System.Exception: Structured variable replacement failed on file F:\Websites\Development\Umbraco\0.1.0.35_1\config\uSync8.config. The file could not be parsed as Json: Unexpected character encountered while parsing value: <. Path '', line 0, position 0. See verbose logs for more details.
at Calamari.Common.Features.StructuredVariables.StructuredConfigVariablesService.DoReplacement(String filePath, IVariables variables, IFileFormatVariableReplacer[] replacersToTry)
at Calamari.Common.Features.StructuredVariables.StructuredConfigVariablesService.ReplaceVariables(RunningDeployment deployment)
at Calamari.Deployment.Conventions.StructuredConfigurationVariablesConvention.Install(RunningDeployment deployment)
at Calamari.Deployment.ConventionProcessor.RunInstallConventions()
at Calamari.Deployment.ConventionProcessor.RunConventions()
Running rollback conventions...
The file looks like this:
<?xml version="1.0" encoding="utf-8"?>
<uSync>
<BackOffice>
<Folder>~/uSync/v8/</Folder>
<FlatFolders>True</FlatFolders>
<ImportAtStartup>False</ImportAtStartup>
<ExportAtStartup>False</ExportAtStartup>
<ExportOnSave>True</ExportOnSave>
<UseGuidFilenames>False</UseGuidFilenames>
<BatchSave>False</BatchSave>
...
I’ve setup the variable /uSync/BackOffice/Folder
The documentation (https://octopus.com/docs/deployment-process/configuration-features/structured-configuration-variables-feature) states:
“If the file extension is not recognized (for example, a file with a config file extension), Octopus will try to parse the files using each of the supported formats until a matching format is found.”
It only appears to be looking for JSON.