[wix-users] Detecting whether a file will be removed on uninstall
Phil Wilson
phil.wilson at mvps.org
Fri Sep 4 14:57:26 PDT 2015
Component removal does not mean file removal if the file is shared with
another setup. The file is removed when the component ref count goes to
zero. That's why registration entries remain when the component is shared -
the component will be marked for removal in one particular uninstall, but
the file and its registration won't be removed if there's another client.
Also the component might be marked for uninstall, but if this is during an
upgrade then it will still be there at the end of the entire upgrade
process, so component uninstall doesn't mean that the file will be gone and
can be unregistered at the end of the new upgrade install. Obviously getting
MSI to manage this is really much much better than trying to predict ref
counting results.
So assuming I wrapped my brain around those scenarios successfully, it
seemed safer to save a copy of the file somewhere at the start of the new
install. At the end of the new install, after a full uninstall or an
upgrade, it can be unregistered with the copy if it is gone. If it's still
there I would assume that there is still a client somewhere, perhaps the
upgrade install that presumably registered it (more code?)or another product
somewhere.
Phil
-----Original Message-----
From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On Behalf Of
Griesshammer, Christoph (GE Healthcare)
Sent: Friday, September 04, 2015 2:29 PM
To: WiX Toolset Users Mailing List
Subject: Re: [wix-users] Detecting whether a file will be removed on
uninstall
$ will get the action state, but would this be the state before or after the
RemoveFiles is scheduled?
Christoph
-----Original Message-----
From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On Behalf Of
Jeremy Drake
Sent: Friday, September 04, 2015 5:23 PM
To: WiX Toolset Users Mailing List
Subject: Re: [wix-users] Detecting whether a file will be removed on
uninstall
Maybe I'm missing something, but why wouldn't you just condition the custom
action on "$componentKey = 2"? You'd need a rollback custom action to
re-register on rollback, of course...
On Fri, 4 Sep 2015, Griesshammer, Christoph (GE Healthcare) wrote:
> Thank you for your answer. You inspired a combination of my workaround and
your workaround:
>
> I'm always going to unregister the file.
> Then it will automatically leave/remove the file.
> Then I'll have a custom action detect if it's still there, and if it is,
I'll re-register it.
>
> Thanks for your help,
> Christoph
>
> -----Original Message-----
> From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On
> Behalf Of Phil Wilson
> Sent: Friday, September 04, 2015 4:39 PM
> To: 'WiX Toolset Users Mailing List'
> Subject: Re: [wix-users] Detecting whether a file will be removed on
> uninstall
>
> I don't think it's possible to predict that reliably. If it's a simple
unregister I'd think about doing it in two parts. First, copy the file to
some temp folder early in the uninstall, then if it's really been removed,
later do the unregister on the temp copy and delete it. I don't think
unregister code cares where it runs from if it's just deleting registry
entries.
>
> Phil
>
> -----Original Message-----
> From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On
> Behalf Of Griesshammer, Christoph (GE Healthcare)
> Sent: Friday, September 04, 2015 1:15 PM
> To: wix-users at lists.wixtoolset.org
> Subject: [wix-users] Detecting whether a file will be removed on
> uninstall
>
> Is there a way to detect whether a file will be removed on uninstall? I
have a custom action that I want to run, only if a file will be removed.
>
> Essentially I want to do:
> If I will remove file A then unregister file A first.
>
> I know, I know. I shouldn't use a CA to (un)register files, but that's
beside the point right now.
>
> Thank you for any help.
>
> Christoph Griesshammer
>
>
> ____________________________________________________________________
> WiX Toolset Users Mailing List provided by FireGiant
> https://urldefense.proofpoint.com/v2/url?u=http-3A__www.firegiant.com_
> &d=BQICAg&c=IV_clAzoPDE253xZdHuilRgztyh_RiV3wUrLrDQYWSI&r=-l6_npd-dx-e
> kbVSbypvaw-IcErQ11UE3f78jQgrCDw&m=_lq5K_eCJvYhCo95ydQe4zvjpe_Ws7a5AYaL
> yil8_10&s=mttIH2sD_ovq9Z5wd5bO7tlCHwKgUhytdHyX1uNcZFw&e=
>
>
>
> ____________________________________________________________________
> WiX Toolset Users Mailing List provided by FireGiant
> https://urldefense.proofpoint.com/v2/url?u=http-3A__www.firegiant.com_
> &d=BQICAg&c=IV_clAzoPDE253xZdHuilRgztyh_RiV3wUrLrDQYWSI&r=-l6_npd-dx-e
> kbVSbypvaw-IcErQ11UE3f78jQgrCDw&m=_lq5K_eCJvYhCo95ydQe4zvjpe_Ws7a5AYaL
> yil8_10&s=mttIH2sD_ovq9Z5wd5bO7tlCHwKgUhytdHyX1uNcZFw&e=
>
> ____________________________________________________________________
> WiX Toolset Users Mailing List provided by FireGiant
> https://urldefense.proofpoint.com/v2/url?u=http-3A__www.firegiant.com_
> &d=BQICAg&c=IV_clAzoPDE253xZdHuilRgztyh_RiV3wUrLrDQYWSI&r=-l6_npd-dx-e
> kbVSbypvaw-IcErQ11UE3f78jQgrCDw&m=PN6Q2RZy0cpje8z-2LwD4k_nKbbhbih95K_9
> Mp4t24E&s=3LwjQLbGtBGpVkn1SOc8xalurTFMSlI8mWGPn1wPzeg&e=
>
____________________________________________________________________
WiX Toolset Users Mailing List provided by FireGiant
https://urldefense.proofpoint.com/v2/url?u=http-3A__www.firegiant.com_&d=BQI
CAg&c=IV_clAzoPDE253xZdHuilRgztyh_RiV3wUrLrDQYWSI&r=-l6_npd-dx-ekbVSbypvaw-I
cErQ11UE3f78jQgrCDw&m=PN6Q2RZy0cpje8z-2LwD4k_nKbbhbih95K_9Mp4t24E&s=3LwjQLbG
tBGpVkn1SOc8xalurTFMSlI8mWGPn1wPzeg&e=
____________________________________________________________________
WiX Toolset Users Mailing List provided by FireGiant
http://www.firegiant.com/
More information about the wix-users
mailing list