问题
Has anyone tried to programatically compile BIML files into dtsx packages? I'm currently writing an application in C#.NET where users can update metadata. When this data has been updated, the BIML files needs to be re-compiled, as SSIS packages will be added/removed upon re-compiling.
In another SO question, it is suggested to copy the functionality from BIDS helper:
Automatically generate SSIS package from BIML script
I have tried this, but I get an error saying:
BimlEngine may only be executed from BidsHelper
This is my code:
        List<string> bimlScriptPaths = new List<string>();
        bimlScriptPaths.Add(@"C:\Users\soren\Documents\Visual Studio 2013\Projects\Integration Services Project2\Integration Services Project2\BimlScript.biml");
        string tempTargetDirectory = "C:\\";
        string projectDirectory = @"C:\Users\soren\Documents\Visual Studio 2013\Projects\Integration Services Project2";
        ValidationReporter v = BidsHelper.CompileBiml(
            typeof(AstNode).Assembly, 
            "Varigence.Biml.BidsHelperPhaseWorkflows.xml", 
            "Compile", 
            bimlScriptPaths, 
            new List<string>(), 
            tempTargetDirectory, 
            projectDirectory, 
            SqlServerVersion.SqlServer2008, 
            SsisVersion.Ssis2014, 
            SsasVersion.Ssas2008, 
            SsisDeploymentModel.Project);
来源:https://stackoverflow.com/questions/30760907/expand-biml-files-programmatically