开发者

Windows Installer, Items in GAC folder not showing up in GAC

In the windows installer, Global assembly cache folder, i have a dll i'd like to register. the reason for this is this file is referenced in a configuration file that's loaded during the custom action execution. When the cust开发者_Go百科om action executes, the configuration can still not locate this file (even though it's supposedly in the GAC). after some review, (GACUTIL /l) it appears that the file is not in the GAC. I can't seem to figure out why. When is this item added to the GAC? After the custom actions? that doesn't seem too reasonable to me. There's also nothing special about this dll. It's generated from project output and is strongly named.

Why else could it not be showing up in the gac?

Thanks


When your managed custom action runs, the assembly is not yet registered in the GAC.

As a rule of thumb, your custom action assembly should never depend on any assembly deployed by the installation package it resides in.

There are tools that provide ways around that rule, but most don't.


Windows Installer uses MsiPublishAssemblies to interact with the Fusion API to install the assembly to the GAC. The problem is while Windows Installer supports transact / rollback behavior, Fusion does not. Therefore Windows Installer waits until the Commit phase of installer execution ( inside InstallFinalize ) to send the DLL's to the GAC. This creates a race condition for things depending on the assembly ( certain custom actions and services that need to be started during the install ).

A good way around this problem is to use WiX DTF to author your managed custom actions. One of the features of DTF is to take all your project content items and references and zip them up into your CA dll. Then at runtime it's all extracted to a temp directory making your dependencies available. Now your assembly is a support file and not the one that is actually deployed so Frederic's comment doesn't apply.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜