开发者

Is it possible to know if an installer is installing/updating/removing in a Custom Action?

开发者 https://www.devze.com 2022-12-11 23:36 出处:网络
Is it possible to know if an installer is installing/updating/removing in a Custom Action? We\'ve made a Custom Action dll in C# and it would be interesting if we could detect what the installer is d

Is it possible to know if an installer is installing/updating/removing in a Custom Action?

We've made a Custom Action dll in C# and it would be interesting if we could detect what the installer is doing. In the WiX xml documents, you could use 'Not Installed', 'REMOVE', etc (see this nice overview). But is it possible to access these variables in a Custom Action?

We tried passing the variable to the Custom Action, but that j开发者_运维问答ust gives us a variable with a string value like 'Not Installed', instead of true or false.


You can reference the ACTION property.

A custom action in Javascript can get the property like this;

var installAction = Session.Property("ACTION");

The possible values are INSTALL, ADVERTISE, or ADMIN.

If that doesn't do it, I'll bet one of the other built-in properties will satisfy.


I'm assuming you are using DTF. Is your custom action scheduled for immeadiate or deferred execution?

For immeadiate, you can use session["Installed"] to access the property yourself. For deferred you'll have to use the CustomActionData pattern to serialize/deserialize the data yourself.

Also I typically don't use these properties anyways. I tend to use component and/or feature action states to associate my custom action to a piece of the installed application. This allows for good behavior when doing maintenance operations like adding and removing a feature.


Hm, we ended up making two entry points in the custom action and checking in de wxs files which one we should call. Not how we wanted to do it, but it works for now.

0

精彩评论

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