Viewing or Saving the Compiled Biml

Some time ago a BIML enthusiast asked me for the location of the temporary files that BIDSHelper create when you generate the SSIS packages in BIDSHelper. I couldn’t help him and explained that the Biml Engine first compiles the Biml documents,  applying any BimlScript in memory and then creates the SSIS packages. The intermediate step isn’t persisted on disk.

Debugging Biml Files Made Easier

Obviously he needed this intermediate result to better debug his Biml files and improve his development efforts. Recently I learned this simple trick to create the intermediate results he wanted. And I like to share it with you in this blog post:

  • Add a new Biml File to your project and name it SaveCompiledBiml.biml
  • Replace the contents of this file with the next code block
<Biml xmlns=””>
string xBiml = RootNode.GetBiml();
XmlDocument xmlDoc = new XmlDocument();
string sFile = @”C:\temp\myBimlFile.xml”;
<#@ template tier=”5″ #>
<#@ import namespace=”Varigence.Hadron.CoreLowerer.SchemaManagement” #>
<#@ import namespace=”System.Xml” #>
<!–BIML Code to save the compiled BIML to file: SaveCompiledBiml.biml–>

Some remarks:

Change the directory and filename of the sFile variable to match your environment / wishes.
In this example I have used tier 5. If you have files with a higher tier change the template tier directive in the SaveCompiledBiml file.  
(BIML files are compiled in the order of their “tier”, the files with the lowest tier first and those with the highest last. The default tier is 0 for files without BimlScript and 1 for files with BimlScript.)

Do you want to improve the quality and speed of your ETL-development?

Biml is quickly gaining popularity as the way to automate the creation of SSIS packages. And thus saving time and money while improving quality. Are you interested in automation of SSIS packages with Biml? Consider my Biml Workshop to get a headstart.