public static CodeCompileUnit ConvertToPipelineRuntimeCodeCompileUnit <T>(this Pipeline <T> pipeline) where T : IPipelineStageList { if (pipeline == null) { throw new ArgumentNullException(nameof(pipeline)); } //see Microsoft.BizTalk.PipelineEditor.PipelineCompiler::GenerateCompilerOutput, Microsoft.BizTalk.PipelineOM, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 var @namespace = new CodeNamespace(pipeline.GetType().Namespace); var @class = @namespace.AddPipelineClass(pipeline); @class.AddConstructor(pipeline.Stages); @class.AddXmlContentProperty(pipeline.GetPipelineRuntimeDocumentSerializer().Serialize()); @class.AddVersionDependentGuidProperty(pipeline.VersionDependentGuid); return(new CodeCompileUnit { Namespaces = { @namespace } }); }