开发者

Setting Public Property in msi Custom Action

开发者 https://www.devze.com 2023-01-07 20:53 出处:网络
Is it possible to set a public property (say MYPROPERTY) from a C# custom a开发者_开发问答ction? I can read properties with Context.Parameters[\"MYPROPERTY\"] that I pass into the custom action data b

Is it possible to set a public property (say MYPROPERTY) from a C# custom a开发者_开发问答ction? I can read properties with Context.Parameters["MYPROPERTY"] that I pass into the custom action data but is there a way to set them too?

Thanks.


I don't know of a way to do it. In most cases, it would be impossible. Visual Studio's setup and deployment projects set their .net custom actions to run "deferred", meaning they run after the msi installation objects have been disposed. Here's the list of the possible operations in that context.

To verify that your .net custom actions are running deferred, use Orca to open the msi file and go to the CustomAction table. If the InstallUtil (VS's utility library that is placed in the "Binary" table of the MSI by VS and exposes a 'C' entry point to MSI that calls into a .NET installer assembly's installation entry points) actions have "3073" as their "Type", that means that they are running as deferred execution (3073 is msidbCustomActionTypeInScript + msidbCustomActionTypeNoImpersonate + msidbCustomActionTypeDll.)

If you create a 'C' custom action in a DLL and put it in your MSI it with a Type of "1" you can execute it during the install sequence and change properties. Unfortunately, VS's install project doesn't support that; it runs every custom action deferred as far as I can tell.

0

精彩评论

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