免费注册COM互操作.组件B参考组件A? [英] Registration free COM interop. assembly B reference assembly A?
问题描述
#import指令在C ++中用于导入类型库." no_registry "属性告诉编译器不要在注册表中搜索类型库.
#import Directive is used in C++ to import a Type Library. "no_registry" attribute Tells the compiler not to search the registry for type libraries.
例如:
#import "XXX.tlb" no_namespace named_guids no_registry
问题:我想在delphi中做同样的事情:我知道使用了 TLIBIMP ,但是我找不到任何 no_registry
.
Quastion:
I want to do the exact same thing in delphi:
I know TLIBIMP is used, but i can not find any attribute like no_registry
.
例如:
TLIBIMP "XXX.tlb" ????
这是怎么做的,或者甚至有可能吗?
How is this done, or is this even possible?
更新:
我有一个并排的并排组件.引用 COM
程序集(A)的 COM
程序集(B).错误可能在清单文件中.如何在清单中定义依赖项?如何使用 Tlbexp.exe
定义依赖项?我已经尝试过:
I have a Side-by side Side-by-side Assemblies.
An COM
assembly(B) that references a COM
assembly(A).
the error might be in the manifest file.
How can I define a dependency in the manifest?
How can i use Tlbexp.exe
to define the dependency?
I have already tried:
<?xml version="1.0" encoding="utf-8"?>
<asmv1:assembly
xmlns="urn:schemas-microsoft-com:asm.v1"
xmlns:asmv1="urn:schemas-microsoft-com:asm.v1"
xmlns:asmv2="urn:schemas-microsoft-com:asm.v2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
manifestVersion="1.0">
<assemblyIdentity
type="win32"
name="CommonInteropB"
version="1.0.0.0"
publicKeyToken="" />
<clrClass
clsid="{XXXXXXXXX}"
progid="CommonInteropB.SomeFactory"
name="CommonInteropB.SomeFactory"
threadingModel="Both" tlbid="{XXXXXXXXXXXXXXXX}"
runtimeVersion="v4.0.30319" />
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32"
name="CommonInteropA"
version="1.0.0.0"
publicKeyToken="" />
</dependentAssembly>
</dependency>
</asmv1:assembly>
并创建类型库:
tlbexp.exe CommonInteropB.dll /tlbreference:"CommonInteropA.tlb" /tlbreference:"C:\Windows\System32\stdole2.tlb" /tlbreference:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\mscorlib.tlb" /out:CommonInteropB.tlb
推荐答案
您的清单看起来不错.依赖关系由 dependency 元素指定.
Your manifest looks fine. The dependency is specified by the dependency element.
tlibimp似乎正在检查注册表和工作目录中的依赖项(尽管我找不到与此相关的文档).如果安装程序需要并行执行,并且希望避免注册DLL,请确保程序集A和程序集B都位于工作目录中,并运行 tlibimp B.tlb [选项]
.
tlibimp seems to check for dependencies in the registry and in the working directory (although I can find no documentation for this). If your setup requires side-by-side execution and you want to avoid registering your DLLs, make sure both assembly A and assembly B reside in the working directory and run tlibimp B.tlb [options]
.
这篇关于免费注册COM互操作.组件B参考组件A?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!