VS2015 - SSIS 自定义组件 - 自定义表单不显示,而是获取高级编辑器
本文关键字:自定义 获取 高级 编辑器 SSIS 组件 表单 VS2015 显示 | 更新日期: 2023-09-27 18:34:13
我正在尝试在VS2015中为SSIS开发自定义源组件。在努力让组件显示在 SSIS 工具箱中之后,我已经设法得到了它,但是当单击组件而不是显示定制表单时,它会直接进入高级编辑器。我已经完全按照Microsoft文档中的说明实现了该类:
https://msdn.microsoft.com/en-us/library/ms136029.aspx
但它仍然没有显示。
我用过
namespace CustomImporter
{
[DtsPipelineComponent(
DisplayName = "Custom importer",
Description = "Custom Importer",
IconResource = "CustomImporter.ico",
UITypeName = "CustomImporter.CustomImporterUI, CustomImporter.CustomImporter, Version=1.1.0.0, Culture=neutral, PublicKeyToken=9b0a5b72a437255d",
ComponentType = ComponentType.SourceAdapter)
]
public class CustomImporter : Microsoft.SqlServer.Dts.Pipeline.PipelineComponent
{
//code to implement the class
}
然后在窗体类中:
using System;
using System.Windows.Forms;
using Microsoft.SqlServer.Dts.Runtime;
using Microsoft.SqlServer.Dts.Pipeline.Design;
using Microsoft.SqlServer.Dts.Pipeline.Wrapper;
namespace CustomImporter
{
class CustomImporterUI : IDtsComponentUI
{
#region Members
IDTSComponentMetaData100 metaData;
IServiceProvider serviceProvider;
#endregion
#region IDtsComponentUI Member
bool IDtsComponentUI.Edit(IWin32Window parentWindow, Variables variables, Connections connections)
{
frmMain editor = new frmMain(metaData, serviceProvider, variables, connections);
DialogResult result = editor.ShowDialog(parentWindow);
if (result == DialogResult.OK)
return true;
return false;
}
void IDtsComponentUI.Help(IWin32Window parentWindow) {}
void IDtsComponentUI.Initialize(IDTSComponentMetaData100 dtsComponentMetadata, IServiceProvider serviceProvider)
{
this.metaData = dtsComponentMetadata;
this.serviceProvider = serviceProvider;
}
void IDtsComponentUI.New(IWin32Window parentWindow){}
void IDtsComponentUI.Delete(IWin32Window parentWindow){}
public void Initialize(IDTSComponentMetaData100 dtsComponentMetadata, IServiceProvider serviceProvider)
{
// Store the component metadata.
this.metaData = dtsComponentMetadata;
}
#endregion
}
}
有什么明显的不对劲的地方吗?我不是 C# 方面的专家,所以我真的不知道指定 UITypeName 参数的 DtsPipeline 代码应该是什么样子。在Microsoft引用链接中,它与其余的类名或程序集名称不匹配,但我已确保当我将组件注册到 GAC 或卸载它时,PublicKeyToken 与我在命令提示符窗口中看到的内容匹配,因此它不可能是这样。我知道这非常繁琐,但我在任何地方都看不到任何文档来显示表单。
我已经在 GAC 中注册了 dll 并将 dll 复制到以下文件夹:C:''Program Files''Microsoft SQL Server''130''DTS''PipelineComponentsC:''Program Files (x86(''Microsoft SQL Server''130''DTS''PipelineComponents
它出现在 SSIS 工具箱中。
任何帮助将不胜感激。
我认为你的UITypeName属性是错误的。 它应该是
"namespace.classThatInheritsFromIDtsComponentUI, AssemblyName"
尝试
UITypeName = "CustomImporter.CustomImporterUI, CustomImporter, Version=1.1.0.0, Culture=neutral, PublicKeyToken=9b0a5b72a437255d"
我也遇到了这个问题。在桌子上敲了两天后,我注意到,在构建项目时,VS 列出了一些关于 UI 项目中Microsoft.SqlServer.DTSPipelineWrap
和Microsoft.SQLServer.DTSRuntimeWrap
程序集引用的Embed Interop Types
属性的警告(代码 CS1762
(。
几天前,我发布了另一个问题的答案,该答案还涉及这些引用的Embed Interop Types
属性,解决方案是将它们的值设置为 false
。因此,我也尝试在这里应用它,令人惊讶的是它解决了这个问题。