在ssis 2012中加载自定义控制流组件的编辑器时出错

时间:2013-04-17 06:11:21

标签: ssis

我在尝试打开自定义控件流组件的编辑器时遇到了问题。我试图复制包所在的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
    }
}

错误与附加到自定义控制流的用户界面有关,它基本上可以创建2种类型的控制流组件,一种是简单转换,另一种你也可以有一些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'或其依赖项之一。

1 个答案:

答案 0 :(得分:0)

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

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

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