开发者

SSIS remote execution with relative paths in C#

I'm trying to execute a remote (Driver package) that in turn executes an SSIS package.

I am using the using Microsoft.SqlServer.Dts.Runtime namespace for this and the below code.

var app = new Application();
var pkg = app.LoadPackage(pkg开发者_StackOverflow中文版Location, null, true);
pkg.ImportConfigurationFile(configfilePath);

var pkgResults = pkg.Execute();
if (pkgResults == DTSExecResult.Success)
{
    isPackageExecuted = true;
}

The problem I am facing is that the remote driver packages has a config file associated with it that uses relative paths. When I execute the driver from my Dev machine we are running from a different folder structure to the deployed Driver/SSIS packages. So I can successfully call the driver but it doesnt find the local packages as its using its local machine starting address as the starting point on the remote server which doesnt exist there.

e.g.

Dev Machine

C:\Code\TFS\Test\SSIS\assembly.dll

Remote Machine

C:\Driver\Configs C:\Driver\Packages

When I call the remote machine it taking "C:\Code\TFS\Test\SSIS" as its starting point and then using relative paths to look for SSIS packages and its failing to find them.

Has anyone got a work around to this or an alternative way?


Update, I sorted the problem by executing psexec from system internals that allows you to set the working directory of the remote machine to handle the relative paths correctly. I then invoked psexec from my C# code using Process.Start ets... passing in the command line execution values



Package.ImportConfigurationFile will happily take an absolute path (as shown in http://msdn.microsoft.com/en-us/library/microsoft.sqlserver.dts.runtime.package.importconfigurationfile.aspx), which will let you avoid the relative path issue (as long as you know the remote machine folder structure, that is).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜