Search code examples
ssisbiml

Cannot reference Project Parameter across BIML Files


I have two biml files:

  • BimlScript.biml - defines project parameters
  • BimlScript1.biml - tries to use this in an expression.

BimlScript.biml:

<Biml xmlns="http://schemas.varigence.com/biml.xsd">
    <Projects>
        <PackageProject Name="Test">
            <Parameters>
                <Parameter Name="Foo" DataType="String">bar</Parameter>
            </Parameters>
        </PackageProject>
    </Projects>
    <Packages>
        <#@ include file="BimlScript1.biml"#>
    </Packages>
</Biml>

BimlScript1.biml:

<Package Name="MyPackage">
    <Variables>
        <Variable Name="TestVariable" DataType="String" EvaluateAsExpression="true">
           @[$Project::Foo]
        </Variable>
    </Variables>
</Package>

However, when I try to generate packages I get the following error:

Variable @[$Project::Foo] was not found

Is it possible to reference Project parameters across files?


Solution

  • I think the problem is you need to have a Packages collection within the Projects collection for the included package to know it's part of a project deployment model.

    <Projects>
        <PackageProject Name="Test">
            <Parameters>
                <Parameter Name="Foo" DataType="String">bar</Parameter>
            </Parameters>
            <Packages>
                <Package PackageName="MyPackage" />
            </Packages>
        </PackageProject>
    </Projects>