すべてのSSISコンポーネントを一覧表示する方法についての情報をオンラインで検索した後、私はC#のプログラムは、問題を解決するための最善の解決策かもしれない書き込みを見つけました。したがって、以下で私は自分の仕事を終わらせるためにVS 2008互換プログラムを書きました。 以下は、SSIS関連のコンポーネントをすべて一覧表示するプログラムを作成し、その結果をExcelファイルに書き込むものです。このソリューションを使用すると、VS 2008で表示されるコンポーネントをクリックする時間を大幅に節約し、コンポーネントプロパティを1つずつ表示できます。私はC#の専門家ではないので、プログラムはうまくコーディングされていないかもしれません。しかし、少なくともそれは動作します!
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using Excel = Microsoft.Office.Interop.Excel;
using System.Reflection;
using Microsoft.SqlServer.Dts.Runtime;
using Microsoft.SqlServer.Dts.Pipeline;
using Microsoft.SqlServer.Dts.Pipeline.Wrapper;
namespace Project1
{
public class SSISFinder
{
public static void Main()
{
// Set ssis app
Microsoft.SqlServer.Dts.Runtime.Application ssisApp = new Microsoft.SqlServer.Dts.Runtime.Application();
ssisApp.PackagePassword = "admin_monkey4ccc";
// Loading dtsx package
Package pkg = ssisApp.LoadPackage("D:\\SummaryETL.dtsx", null);
// Open Excel Sheet
Excel.Application oXL = new Excel.Application();
Excel.Workbook oWB;
Excel.Worksheet oSheet;
string fileName = "D:\\test.xls";
oWB = oXL.Workbooks.Add(Missing.Value);
oSheet = (Excel.Worksheet)oWB.ActiveSheet;
// List data flow package
List<DtsContainer> containers = FindExecutablesByType((IDTSSequence)pkg, "PIPELINE");
int counter = 1;
foreach (DtsContainer exec in containers)
{
TaskHost th = exec as TaskHost;
MainPipe pipe = (MainPipe)th.InnerObject;
foreach (IDTSComponentMetaData100 comp in pipe.ComponentMetaDataCollection)
{
if (comp.Description == "OLE DB Source")
{
oSheet.Cells[counter, 1] = comp.Description;
oSheet.Cells[counter, 2] = th.Properties["Name"].GetValue(th).ToString();
oSheet.Cells[counter, 3] = comp.Name;
oSheet.Cells[counter, 4] = comp.CustomPropertyCollection["SqlCommand"].Value;
Console.WriteLine(" Component Name = " + comp.Name);
counter++;
}
else if (comp.Description == "OLE DB Destination")
{
oSheet.Cells[counter, 1] = comp.Description;
oSheet.Cells[counter, 2] = th.Properties["Name"].GetValue(th).ToString();
oSheet.Cells[counter, 3] = comp.Name;
oSheet.Cells[counter, 4] = comp.CustomPropertyCollection["OpenRowset"].Value;
Console.WriteLine(" Component Name = " + comp.Name);
counter++;
}
}
}
oWB.SaveAs(fileName, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Excel.XlSaveAsAccessMode.xlShared, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
oWB = null;
oXL.Quit();
oXL = null;
}
static List<DtsContainer> FindExecutablesByType(IDTSSequence sequence, string typeName)
{
string typeNameUpper = typeName.ToUpper();
List<DtsContainer> matchingExecutable = new List<DtsContainer>();
foreach (Executable e in sequence.Executables)
{
if (e.GetType().ToString().ToUpper().Contains(typeNameUpper))
{
matchingExecutable.Add((DtsContainer)e);
}
if (e is TaskHost)
{
TaskHost taskHost = (TaskHost)e;
if ((typeNameUpper.Contains("DATA FLOW")
|| typeNameUpper.Contains("DATAFLOW")
|| typeNameUpper.Contains("MAINPIPE")
|| typeNameUpper.Contains("PIPELINE")
) && taskHost.InnerObject is IDTSPipeline100
)
{
matchingExecutable.Add((DtsContainer)e);
}
else if (taskHost.InnerObject.GetType().ToString().ToUpper().Contains(typeNameUpper))
{
matchingExecutable.Add((DtsContainer)e);
}
}
if (e is IDTSSequence)
{
matchingExecutable.AddRange(FindExecutablesByType((IDTSSequence)e, typeNameUpper));
}
}
return matchingExecutable;
}
}
}
提供された回答を評価する機会はありましたか? – billinkc