从BIML脚本自动生成SSIS包

nor*_*orm 3 c# vb.net ssis ssis-2008 biml

完成BIML脚本(使用BIDS SQL Server 2008)创建SSIS包后,只需右键单击BIML文件,然后单击生成SSIS包.

如何通过代码(例如C#或SQL)生成SSIS包?我可以想象一下BimlEngine.dll的一些shell脚本,例如BimlEngine.dll - "myFileServer\myBimlScript","生成SSIS包"

我找到了这个c#代码项目 https://github.com/jgsato/BimlGen

特别是这个文件 https://github.com/jgsato/BimlGen/blob/master/BimlGenerator.cs

我只是不确定如何使用它.

谢谢你的帮助.

bil*_*nkc 6

您链接的代码是一种基于SMO生成Biml,xml的机制.

您的目的是重现右键单击/生成SSIS包,从而将Biml XML转换为DTSX的XML.要做到这一点,你需要看看BidsHelper是如何做到的.在类BimlExpandPlugin中,您将找到特定于版本的调用BidsHelper.CompileBiml

ValidationReporter validationReporter = BidsHelper.CompileBiml(
    typeof(AstNode).Assembly, 
    "Varigence.Hadron.BidsHelperPhaseWorkflows.xml", 
    "Compile", bimlScriptPaths, 
    new List<string>(), 
    tempTargetDirectory, 
    projectDirectory, 
    SqlServerVersion.SqlServer2008, 
    SsisVersion.Ssis2012, 
    SsasVersion.Ssas2008, 
    DeployPackagesPlugin.IsLegacyDeploymentMode(project) ? 
        SsisDeploymentModel.Package : 
        SsisDeploymentModel.Project);
Run Code Online (Sandbox Code Playgroud)

需要注意的是,Varigence的人员为BidsHelper提供了作为其产品Mist能力的子集的功能.其中一件事就是跳过XML mashing并只使用本机.NET对象来创建和描述SSIS对象.如果您想使用.NET对象,那么您需要购买许可证.