I'm writing biml in visual studio and have a problem when using c#. I get an error saying "} expected" pointing to the closing bracket of the if statement, but I can't find where I'm missing something. I'm new to this and aware that there are probably other mistakes too :)
<#foreach(var order in metaData.Attributes.Select(x => x.ORDER).Distinct()){#>
<Container Name="Sequence Container_<#=order#>">
<PrecedenceConstraints>
<#if (order == "0"){#>
<Inputs>
<Input OutputPathName="Set IDRunMaster.Output"/>
</Inputs>
<#}#>
<#else{#>
<#int previousOrder = Int32.Parse(order) - 1;#>
<Inputs>
<Input OutputPathName="Sequence Container_<#previousOrder#>"/>
</Inputs>
<#}#>
</PrecedenceConstraints>
<Tasks>
<#foreach(var item in metaData.Attributes.Where(y => y.ORDER == order).Select(x => x.ORIGINAL_OBJECT).Distinct()){#>
<ExecutePackage Name="DWH_<#=item#>">
<ExternalProjectPackage Package="DWH_<#=item#>.dtsx" />
</ExecutePackage>
<#}#>
</Tasks>
</Container>
<#}#>
First syntax error (not reported)
You're missing a semicolon here or you intended to use
<#=hereThe reported error is weird and while I'm not fully awake, I don't see what the root cause is.
My approach was to format your code into what my brain expects with regard to brace placement.
This code still has the error about unmatched
{This, does not
all I did was eliminate the leading space in front of the directive in the else clause.
Going back to your original version, same thing. So, something in line 17 is making things go haywire but as I don't have a working minimal reproduction, I can't say for certain what you have wrong.
You can also make the error go away with the following but still just bandage over a shotgun wound
This isn't python or FORTRAN so whitespace should not be the culprit and yet, here we are