使用 InstallShield 将程序集注册到 GAC

发布于 2024-08-26 07:44:22 字数 169 浏览 4 评论 0原文

我必须使用 InstallSheild 将多个程序集注册到 GAC,并且还需要将程序集复制到 INSTALLDIR 上。最好的方法是什么?我还需要调用 regasm.exe 进行程序集;我可以使用InstallShield 来做到这一点吗?

我真的需要为每个必须在 GAC 中注册的程序集一个新的“组件”吗?

I have to register multiple assemblies to GAC using InstallSheild and also I need the assemblies to be copied on the INSTALLDIR also. What's the best way to do it? Also I need to call regasm.exe for an assembly; can I do this using InstallShield?

I really need a new 'component' for each assembly that has to be registered in GAC?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

波浪屿的海角声 2024-09-02 07:44:22

此答案假设您使用的是 Windows Installer 项目类型。

1)为每个DLL文件创建一个组件,将其作为密钥文件并将目标文件夹设置为GlobalAssemblyCache。这指示 Windows Installer 使用 MsiPublishAssemblies 标准操作,该操作又调用 Fusion 以在 GAC 中注册程序集。这实际上就是 GACUTIL 为您所做的事情。请记住:GACUTIL 不可重新分发。如果装配体具有伴随文件,请将它们作为伴随文件添加到同一零部件中。

2) 如果您的程序集是 ComVisible,请为每个 DLL 创建一个组件,将其标记为密钥文件并将 .NET ComInterop 设置为 true。这将导致在构建时提取 COM 信息,并告诉 Windows Installer 使用 MsiPublishAssemblies 标准操作将信息写入注册表。注意:如果您在程序集的注册部分中有自定义用户代码,则不会捕获该代码。根据 MSDN,regasm /regfile 不会执行此代码路径。您必须手动将此信息输入到该组件的 InstallShield 注册表视图中。

3) 是的,您可以全局和/或私有地部署强名称程序集。私有的是否可见取决于带有引用的程序集是否设置了 UseSpecific。

This answer assumes you are using a Windows Installer project type.

1) Create a component for each DLL file, make it as the keyfile and set the destination folder to GlobalAssemblyCache. This instructs Windows Installer to use the MsiPublishAssemblies standard action which in turn makes calls into Fusion to register the assembly in the GAC. This is effectively what GACUTIL does for you. Remember: GACUTIL is not redistributable. If the assembly has companion files, add them as companion files to the same component.

2) If your assembly is ComVisible, create a component for each DLL, mark it as the keyfile and set the .NET ComInterop to true. This will cause the COM information to be extracted at build time, and tell Windows Installer to use the MsiPublishAssemblies standard action to write the information to the registry. Note: If you have custom user code in the registration section of the assembly this will not be captured. This is per MSDN that regasm /regfile does not execute this code path. You will have to manually enter this information into InstallShield's registry view for that component.

3) Yes, you can deploy a strong-named assembly both globally and/or privatly. Whether the private one will be seen or not depends on whether the assembly with the reference has UseSpecific set or not.

美胚控场 2024-09-02 07:44:22

是的。就系统而言,这是两个不同的文件。 AFAIK,您不能在 GAC 中拥有一个文件,同时将其放在目标计算机上的随机文件夹中。

理论上,如果它位于 GAC 中,则产品目录中不需要它。如果它位于 GAC 中,则该版本将是加载的版本,而不是产品目录中的版本。但是,如果您还需要为 COM 互操作注册它,那就会变得更加困难。我可能是错的,但当我尝试时,我必须同时拥有两者:一个在目录中,一个在 GAC 中。

但实际上,如果您在产品目录中需要它,那么您可能在 GAC 中不需要它。如果它总是从任何地方的任何程序加载,那么 GAC 是一个不错的地方。如果您将其放入 GAC For COM 互操作中,则没有必要;通过将其指向已安装的文件夹来注册它,如果您正确配置了 installshield,它将可以正常工作。

Yes. As far as the system cares, those are two different files. AFAIK, you can't have a file in the GAC and have it be in a random folder on the target computer at the same time.

Theoretically, if it's in the GAC, you don't need it in the product directory. If it's in the GAC, that will be the version loaded, not the one in the product directory. However, it gets harder if you need to, say, register it for COM interop too. I may be wrong, but when I tried, I had to have both: one in the directory, one in the GAC.

But really, you probably don't need it in the GAC if you need it in the product directory. If it's being loaded from any program anywhere, always, then the GAC is a decent place for it. If you're putting it in the GAC For COM interop, that's unnecessary; registering it by pointing it to the folder that you've installed it will work fine if you have installshield configured correctly.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文