如何在Windows Installer程序包添加的注册表项中引用GAC中程序集的路径?

时间:2022-05-14 12:45:39

I have a .NET assembly that contains classes to be registered as ServicedComponent through EnterpriseServices (COM+) and invoked through COM RPC by a third-party application. Therefore, I need to both add it to the GAC and add a registry entry under HKEY_CLASSES_ROOT\CLSID\{clsid}\CodeBase with the path to the assembly DLL within the GAC folder. (I can't rely on regsvcs to do it, because this is a 32-bit assembly --- it relies on 32-bit third-party components --- and the third-party application I referred to before cannot see classes in Wow6432Node)

我有一个.NET程序集,其中包含通过EnterpriseServices(COM +)注册为ServicedComponent并由第三方应用程序通过COM RPC调用的类。因此,我需要将它添加到GAC并在HKEY_CLASSES_ROOT \ CLSID \ {clsid} \ CodeBase下添加一个注册表项,其中包含GAC文件夹中程序集DLL的路径。 (我不能依赖regsvcs来做这件事,因为这是一个32位的程序集 - 它依赖于32位第三方组件---而我之前提到的第三方应用程序无法看到类中的Wow6432Node)

So the question is:

所以问题是:

Are paths to assemblies to be created in the GAC, or at least the path to the GAC folder itself, available in Windows Installer as properties that can be used in values of registry keys etc.?

是否在GAC中创建程序集的路径,或者至少是GAC文件夹本身的路径,在Windows Installer中可用作可以在注册表项值等中使用的属性?

1 个解决方案

#1


2  

If you have a component per file, which you should anyway, the KeyPath of the component points to the location where the file gets installed (in this case the GAC). You can use the component key as a token in the value field of the entry in the Registry table in your MSI.

如果每个文件都有一个组件,无论如何,组件的KeyPath指向文件的安装位置(在本例中为GAC)。您可以使用组件密钥作为MSI中Registry表中条目的值字段中的标记。

Assuming you have an assembly with a File key in the File table of "assmb.dll" and its corresponding component, also "assmb.dll". You can set the value field in the Registry table to register your assembly to [$assmb.dll], and it will get resolved to the install location of the assembly. If this directory is the GAC, it will be resolved to the location of the GAC.

假设在“assmb.dll”的File表及其相应的组件中有一个带有File键的程序集,也就是“assmb.dll”。您可以在Registry表中设置值字段以将程序集注册到[$ assmb.dll],它将被解析为程序集的安装位置。如果此目录是GAC,则它将被解析为GAC的位置。

You can find more information about Formatted fields in an MSI here.

您可以在此处找到有关MSI中格式化字段的更多信息。

#1


2  

If you have a component per file, which you should anyway, the KeyPath of the component points to the location where the file gets installed (in this case the GAC). You can use the component key as a token in the value field of the entry in the Registry table in your MSI.

如果每个文件都有一个组件,无论如何,组件的KeyPath指向文件的安装位置(在本例中为GAC)。您可以使用组件密钥作为MSI中Registry表中条目的值字段中的标记。

Assuming you have an assembly with a File key in the File table of "assmb.dll" and its corresponding component, also "assmb.dll". You can set the value field in the Registry table to register your assembly to [$assmb.dll], and it will get resolved to the install location of the assembly. If this directory is the GAC, it will be resolved to the location of the GAC.

假设在“assmb.dll”的File表及其相应的组件中有一个带有File键的程序集,也就是“assmb.dll”。您可以在Registry表中设置值字段以将程序集注册到[$ assmb.dll],它将被解析为程序集的安装位置。如果此目录是GAC,则它将被解析为GAC的位置。

You can find more information about Formatted fields in an MSI here.

您可以在此处找到有关MSI中格式化字段的更多信息。