我在文件系统的文件夹中有几个.dtsx包。
我尝试使用下一个脚本从包中提取其他信息:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using Microsoft.SqlServer.Server;
using Microsoft.SqlServer.Dts.Runtime;
using Microsoft.SqlServer.Dts;
namespace ImportDataFromPackage
{
class Program
{
static void Main(string[] args)
{
// The pkg variable points to a package
// installed with the SSIS samples.
string pkg = @"D:\MyFolder\Ryder_project\testpackage\ACS\ACS_Available_Months.dtsx";
Application app = new Application();
Package p1 = app.LoadPackage(pkg, null);
p1.Description = "CalculatedColumns package";
app.SaveToDtsServer(p1, null, @"File System\myp1Package", "YOURSERVER");
PackageInfos pInfos = app.GetDtsServerPackageInfos(@"File System", "YOURSERVER");
foreach (PackageInfo pinfo in pInfos)
{
Console.WriteLine("Package Information");
Console.WriteLine("CreationDate: {0}", pinfo.CreationDate);
Console.WriteLine("Description: {0}", pinfo.Description);
Console.WriteLine("Flags: {0}", pinfo.Flags);
Console.WriteLine("Folder: {0}", pinfo.Folder);
Console.WriteLine("Name: {0}", pinfo.Name);
Console.WriteLine("PackageDataSize: {0}", pinfo.PackageDataSize);
Console.WriteLine("PackageGuid: {0}", pinfo.PackageGuid);
Console.WriteLine("VersionBuild: {0}", pinfo.VersionBuild);
Console.WriteLine("VersionComments {0}", pinfo.VersionComments);
Console.WriteLine("VersionGUID {0}", pinfo.VersionGUID);
Console.WriteLine("VersionMajor {0}", pinfo.VersionMajor);
Console.WriteLine("VersionMinor {0}", pinfo.VersionMinor);
Console.WriteLine();
}
}
}
}
我得到下一个错误:
请帮我解决问题。
答案 0 :(得分:1)
SSIS包.dtsx
文件是Xml文件,因此您可以使用XML Parser和其他技术,正则表达式来获取其信息。您可以使用SQL,.Net和其他技术实现此目的。
您可以按照我对以下问题的详细解答:
此外,如果您正在寻找逆向工程,您可以查看以下链接: