0

我在尝试打开自定义控制流组件的编辑器时遇到问题。我试图复制包所在的dll,但没有帮助。如果我做错了什么或如何解决此问题,请告诉我。

Here is the code:
Main class inherits TASK                         

namespace SSIS.Custom.ControlFlowUI
{
        [DtsTask  (
       DisplayName = "CopyTable",
       Description = "A custom Unzip task for demonstration purposes.",
       TaskType = "CustomComponent",
       UITypeName = "CopyTableTaskUI, CopyTable, Version=1.0.0.0,Culture=Neutral, PublicKeyToken=9097a336d1055e0b")]

    public class CopyTable : Task
    {
         #region Override methods

            public override DTSExecResult Validate(Connections connections,
            VariableDispenser variableDispenser, IDTSComponentEvents componentEvents,
            IDTSLogging log)
            {
                return base.Validate(connections, variableDispenser, componentEvents, log);
            }

            public override DTSExecResult Execute(Connections connections, VariableDispenser variableDispenser, IDTSComponentEvents componentEvents, IDTSLogging log, object transaction)
            {
                try
                {
                    ValidateSchema(@"GGN19\MSSQL12");

                    //   Return success.
                    return DTSExecResult.Success;
                }
                catch (System.Exception exception)
                {
                    //   Capture exceptions, post an error, and fail validation.

                    return DTSExecResult.Failure;
                }
            }
        #endregion

        #region Public methods

            public string ValidateSchema(string tableName)
            {
                GetTableList(tableName);
                return "";
            }

            private List<string> GetTableList(string ServerName)
            {
                List<string> lTables = new List<string>();
                try
                {

                    SqlConnection dbConn = new SqlConnection("Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=TestingTmp;Data Source=" + ServerName);
                    SqlCommand dbCmd = new SqlCommand("Select NAME from sysobjects where type ='U';", dbConn);
                    dbConn.Open();
                    SqlDataReader SqlDR = dbCmd.ExecuteReader();

                    while (SqlDR.Read())
                    {
                        lTables.Add(SqlDR.GetString(0));
                    }
                    dbConn.Close();

                }
                catch (Exception ex) { }
                return lTables;
            }

            private bool ValidateTableSchema(string ServerName, string table1, string table2)
            {
                SqlConnection dbConn = new SqlConnection("Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=msdb;Data Source=" + ServerName);
                SqlCommand dbCmd = new SqlCommand("Select * from '" + table1 + "';", dbConn);
                dbConn.Open();
                SqlDataReader SqlDR = dbCmd.ExecuteReader();
                DataTable schema = SqlDR.GetSchemaTable();


                dbCmd = new SqlCommand("Select * from '" + table2+  "';", dbConn);
                dbConn.Open();
                SqlDR = dbCmd.ExecuteReader();
                DataTable schema2 = SqlDR.GetSchemaTable();

                return schema.Equals(schema2);

             }

        #endregion

       }

UI Class
namespace ControlFlowUI
{
    public class CopyTableTaskUI : IDtsTaskUI
    {

        #region // Fields
         private TaskHost _taskHost;
        #endregion

        #region Properties

        #endregion

        #region Methods

         public void Initialize(TaskHost taskHost, IServiceProvider serviceProvider)
         {

             _taskHost = taskHost;
         }

         public ContainerControl GetView()
        {

            return new CopyTableFrm(_taskHost);
        }

        #endregion


             #region IDtsTaskUI Members

             public void Delete(IWin32Window parentWindow)
             {
                 throw new NotImplementedException();
             }

             public void New(IWin32Window parentWindow)
             {
                 throw new NotImplementedException();
             }

             #endregion
    }
}

错误与附加到自定义控制流的用户界面有关,基本上你可以创建两种类型的控制流组件一种是简单的转换,另一种你也可以有一些 UI 来获取用户输入,ssis 将允许你双击在组件上并提供值...所以当我双击 com 以获取 UI 时,它会抛出错误.. 标题:Microsoft Visual 无法显示此任务的编辑器。无法加载类型名称“CopyTableTaskUI, CopyTable, Version=1.0.0.0,Culture=Neutral, PublicKeyToken=9097a336d1055e0b”指定的任务用户界面。无法加载文件或程序集“CopyTable,Version=1.0.0.0,Culture=neutral,PublicKeyToken=9097a336d1055e0b”或其依赖项之一。这

4

1 回答 1

0

我遇到了类似的错误“无法加载类型:”,然后是“验证组件编辑器是否已正确安装。”。当我在客户端机器上部署我的 dll 时出现了这个问题,它在创建后的第二个会话中重新编辑 DTSX 包后出现。自定义 UI 不会出现。

我通过将自定义 dll 复制到 Visual Studio 所在的文件夹 (devenv.exe) 来解决这个问题。这个 VS 是一个 shell 版本,适合创建 DTSX 包和其他东西。

在 GAC 中安装我的 DLL 没有帮助。我必须提到我的包没有强签名,但我使用“reg file / Merge”运行异常但无济于事。

于 2015-02-26T21:28:00.013 回答