1

将 SQL Server 2016 (13.0.15000.23) 和 SSIS 与带有最新 SSDT 的 VS 2015 社区一起使用,我有一个带有 1 个脚本任务的简单 SSIS 测试包。在该任务中,我只是添加了对 Renci.sshnet (2014.4.6.0) 的引用,它是一个 .NET 4.0 DLL。
我把项目目标框架改成4.0就可以基本调用创建连接了:

Console.WriteLine("Start");

Renci.SshNet.ConnectionInfo ConnNfo = new   
Renci.SshNet.ConnectionInfo("hostOrIP", 22, "username",
       new AuthenticationMethod[]{

            // Pasword based Authentication
            new PasswordAuthenticationMethod("username","password"),

            // Key Based Authentication (using keys in OpenSSH Format)
            new PrivateKeyAuthenticationMethod("username",new PrivateKeyFile[]{
                new PrivateKeyFile(@"..\openssh.key","passphrase")
            }),
       }
   );

当我运行它时,立即得到一个 DTS 脚本任务:运行时错误“调用的目标已引发异常”。

我已经获取了代码并从中制作了一个独立的控制台应用程序。即使是 4.5,它也运行良好。

整个事情在具有 Sql Server 2008R2 的旧服务器中使用完全相同的代码运行良好

我在新配置中遗漏了一些东西。每当我引用和使用 renci.sshnet 时它都不会运行

我也尝试在写行上设置一个断点,但它没有让我到达那里..在我到达它之前它失败了..

有任何想法吗?我没有选择。

提前致谢。

-肯

4

1 回答 1

2

显然,您必须将任何引用的 DLL 添加到 GAC !是的..忘记了..这修复了它...仅从VS命令提示符的管理员运行..

   D:\Flint\References>gacutil /i Renci.SshNet.dll
   Microsoft (R) .NET Global Assembly Cache Utility.  Version 4.0.30319.0
   Copyright (c) Microsoft Corporation.  All rights reserved.

   Assembly successfully added to the cache

将此用作参考... http://microsoft-ssis.blogspot.ru/2011/05/referencing-custom-assembly-inside.html

于 2016-06-24T02:20:14.610 回答