Facing issues with variable replacement in rdl/xml files

Hello, we are facing a issue trying to do Structured configuration variables changes on *.rdl files which are in the format of XML.

In our variables I have things like:
//DataSourceReference : test-replace
//DataSourceReference[1]/text()[1] : test-replace
/Report/DataSources/DataSource/@Name : test-replace
/Report/DataSources/DataSource/DataSourceReference : test-replace

However, always the message :

The file at C:\Octopus\Applications\Dev\5.8.0.2069-unknown-B525\report.rdl does not match any known filename patterns. The file will be tried as multiple formats and will be treated as the first format that can be successfully parsed. 
The registered replacers we will try, in order, are: JsonFormatVariableReplacer,XmlFormatVariableReplacer,YamlFormatVariableReplacer,PropertiesFormatVariableReplacer 
Attempting structured variable replacement on file C:\Octopus\Applications\Dev\5.8.0.2069-unknown-B525\report.rdl with format Json 
The file at C:\Octopus\Applications\Dev\5.8.0.2069-unknown-B525\report.rdl couldn't be parsed as Json: Unexpected character encountered while parsing value: <. Path '', line 0, position 0. 
Attempting structured variable replacement on file C:\Octopus\Applications\Dev\5.8.0.2069-unknown-B525\report.rdl with format Xml 
No structures have been found that match variable names, so no structured variable replacements have been applied. 
Structured variable replacement succeeded on file C:\Octopus\Applications\Dev\5.8.0.2069-unknown-B525\report.rdl with format Xml

Based on that message, the .rdl is being treated as a xml, but why can’t we get any of the XPath stuff to work?

The .rdl file

<?xml version="1.0" encoding="utf-8"?>
<Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
  <Body>
    <ReportItems>
      <Tablix Name="Tablix1">
        <TablixBody>
        </TablixBody>
        <TablixColumnHierarchy>
          <TablixMembers>
            <TablixMember />
          </TablixMembers>
        </TablixColumnHierarchy>
        <TablixRowHierarchy>
          <TablixMembers>
            <TablixMember>
              <Group Name="Parent">
                <GroupExpressions>
                  <GroupExpression>=Fields!Parent.Value</GroupExpression>
                </GroupExpressions>
                <PageBreak>
                  <BreakLocation>Between</BreakLocation>
                </PageBreak>
              </Group>
              <SortExpressions>
                <SortExpression>
                  <Value>=Fields!Parent.Value</Value>
                </SortExpression>
              </SortExpressions>
              <TablixMembers>
                <TablixMember />
              </TablixMembers>
            </TablixMember>
          </TablixMembers>
        </TablixRowHierarchy>
        <DataSetName>Results</DataSetName>
        <Height>0.25in</Height>
        <Width>7.2in</Width>
        <Style>
          <Border>
            <Style>None</Style>
          </Border>
        </Style>
      </Tablix>
    </ReportItems>
    <Height>0.25in</Height>
    <Style />
  </Body>
  <Width>7.2in</Width>
  <Page>
    <LeftMargin>0.5in</LeftMargin>
    <RightMargin>0.5in</RightMargin>
    <TopMargin>0.5in</TopMargin>
    <BottomMargin>0.5in</BottomMargin>
    <Style />
  </Page>
  <AutoRefresh>0</AutoRefresh>
  <DataSources>
    <DataSource Name="DataSourceA">
      <DataSourceReference>DataSourceA</DataSourceReference>
      <rd:SecurityType>None</rd:SecurityType>
    </DataSource>
  </DataSources>
  <DataSets>
    <DataSet Name="Results">
      <Query>
        <DataSourceName>DataSourceA</DataSourceName>
        <QueryParameters>
          <QueryParameter Name="@ParentInstanceIds">
            <Value>=Parameters!ParentInstanceIds.Value</Value>
          </QueryParameter>
        </QueryParameters>
        <CommandType>StoredProcedure</CommandType>
        <CommandText>Report_TierGetParents</CommandText>
      </Query>
      <Fields>
        <Field Name="Parent">
          <DataField>Parent</DataField>
          <rd:TypeName>System.String</rd:TypeName>
        </Field>
      </Fields>
    </DataSet>
  </DataSets>
  <ReportParameters>
    <ReportParameter Name="ParentInstanceIds">
      <DataType>String</DataType>
      <Prompt>Parent Instance Ids</Prompt>
    </ReportParameter>
    <ReportParameter Name="StudentUid">
      <DataType>String</DataType>
      <Prompt>Student Uid</Prompt>
    </ReportParameter>
    <ReportParameter Name="UserId">
      <DataType>String</DataType>
      <Prompt>User Id</Prompt>
    </ReportParameter>
  </ReportParameters>
  <Language>en-US</Language>
  <ConsumeContainerWhitespace>true</ConsumeContainerWhitespace>
  <rd:ReportUnitType>Inch</rd:ReportUnitType>
  <rd:ReportID>8c3cf75f-8d46-4d5a-87eb-cec6e482cc2a</rd:ReportID>
</Report>

Hi @DIST_Technology_Dev_Systems,
It’s most likely the namespace on the Report node causing issues. Have a look at this workaround and see if that helps: Structured configuration variables - Octopus Deploy.

Thanks,
Mark

Hey Mark,

Yep, that is what we found out as well. Just needed to scroll farther lol.

Thanks!

1 Like

Excellent! Glad you got it working!

Happy deployments!
Mark