Manually generate ActiveX wrapper after TLBIMP-ed dlls?(在 TLBIMP-ed dll 之后手动生成 ActiveX 包装器?)
问题描述
我有几个 ActiveX 组件需要从 C# 项目中访问.
I have several ActiveX components that needed to be accessed from a C# project.
我可以通过 Visual Studio 的添加引用对话框导入它们,该对话框也会自动生成包装类.(即 ABCLib 和 AxABCLib)
I can import them via Visual Studio's add reference dialog, which will also automatically generate wrappers class. (i.e. ABCLib and AxABCLib)
我知道我可以通过在每个单独的 OCX 文件上运行 TLBIMP/primary 来手动生成主互操作程序集,但我找不到生成 ActiveX 包装器的方法,除非我通过 Visual Studio 执行此操作用户界面.
I know that I can generate the primary interop assembly manually by running TLBIMP /primary on each individual OCX file but I could not find a way to generate the ActiveX wrapper unless I do it via Visual Studio user interface.
是否有在 .NET SDK 中生成 ActiveX 包装器的命令行版本?
Is there a command-line version that generate the ActiveX wrapper in the .NET SDK?
我想从我手动从 TLBIMP 获得的 PIA 生成 AxABCLib 版本.(即设置命名空间、输出 dll 文件名等)有可能吗?
I want to generate the AxABCLib version from the PIA I got from TLBIMP manually. (i.e. setting namespaces, output dll filenames etc.) Is it possible?
推荐答案
哦……看了看TLBIMP所在的文件夹找到了.
Oh... found it after looking at the folder where TLBIMP belongs.
它叫做AxImp.
C:Program FilesMicrosoft SDKsWindowsv6.0AinAxImp.exe
所以基本上,要在您自己的自定义命名空间中生成 PIA DLL:
So basically, to generate a PIA DLL in your own customized namespace:
- 注册您的 OCX 
- Register your OCX 
regsvr32 abc.ocx
通过运行为您的 ocx 生成一个强名称密钥对
Generate a strong name key pair for you ocx by running
sn -k
运行 TLBIMP 并指定所需的命名空间
Run TLBIMP and specify the desired namespace
tlbimp abc.ocx/primary/keyfile:abc.snk/out:abc.dll/namespace:MyNamespace
在 ocx 上运行 AXIMP 并使用 rcw 开关来使用您自己手动生成的 PIA DLL.
Run AXIMP on the ocx and use the rcw switch to use your own manully generated PIA DLL.
aximp abc.ocx/source/rcw:abc.dll
应该可以的.
然而,导入古代 TLB 存在一些问题.我还不确定如何解决这个问题.
There are however some problems with ancient TLBs being imported. I am not sure how to fix that yet.
这篇关于在 TLBIMP-ed dll 之后手动生成 ActiveX 包装器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在 TLBIMP-ed dll 之后手动生成 ActiveX 包装器?
 
				
         
 
            
        基础教程推荐
- 经典 Asp 中的 ResolveUrl/Url.Content 等效项 2022-01-01
- 将事件 TextChanged 分配给表单中的所有文本框 2022-01-01
- 错误“此流不支持搜索操作"在 C# 中 2022-01-01
- 在 VS2010 中的 Post Build 事件中将 bin 文件复制到物 2022-01-01
- JSON.NET 中基于属性的类型解析 2022-01-01
- 如何动态获取文本框中datagridview列的总和 2022-01-01
- 从 VS 2017 .NET Core 项目的发布目录中排除文件 2022-01-01
- 是否可以在 asp classic 和 asp.net 之间共享会话状态 2022-01-01
- 首先创建代码,多对多,关联表中的附加字段 2022-01-01
- 全局 ASAX - 获取服务器名称 2022-01-01
 
    	 
    	 
    	 
    	 
    	 
    	 
    	 
    	 
						 
						 
						 
						 
						 
				 
				 
				 
				