Persisted variables and upgrades

Got a problem you cannot solve? Try here.
Post Reply
Frank
Posts: 59
Joined: Tue Oct 27, 2009 9:16 am
Location: Netherland

Persisted variables and upgrades

Post by Frank »

I'm encountering a problem for which I can't find an easy solution.

When our product is installed a license file is copy from a location indicated by the user to the $TARGETDIR$
So if we run our deinstaller, this file (ofcourse) is not deleted.

Now for uninstalling:
One way is when the user runs the installer again with the same upgrade code. He instructs the installer to remove the product.
I can remove the license file because $TARGETDIR$ is persisted. I'll use (Run Program cmd.exe /c del $TARGETDIR$/licensefile)

The other way is that when the user runs the installer with a different upgrade code.
As a prerequisite it's now necessary to uninstall the previous version. In this scenario I can't delete the license file because the $TARGETDIR$ has the initial value (NOT what the user set)
I can introduce a new variable and try to persist that, but that value is gone when the installer with a new upgrade code is running (is that a bug???)

I know about 'Copy/Move Files' and the subsequent 'Delete Files on Uninstall'. But I can't use 'Copy/Move Files' with variables for the filename, and guess what the filename is variable.
I've tried combining 'Run Program cmd.exe /c xcopy "$THIS$" "$THAT$"' with 'Delete Files' but that also doesn't work (the file is still there after uninstall).

Any thoughts on how to move forward?
giaviv
Posts: 2039
Joined: Fri Dec 17, 2010 1:39 pm

Re: Persisted variables and upgrades

Post by giaviv »

Dear Frank,

Reading your next post, I understand that you were able to figure this out?
Aviv Giladi
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Product Guides - http://www.installaware.com/publication ... guides.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
Frank
Posts: 59
Joined: Tue Oct 27, 2009 9:16 am
Location: Netherland

Re: Persisted variables and upgrades

Post by Frank »

Actually no. What you call the next post, is actually my previous post :D. Although I posted it shortly after...

I did resolve the issue however 8) . The lucky fact that our software expects to find a 'certain' filename is my saviour.
I now use 'Install Files' to place a dummy file with that 'cer'tain' name during installation and copy over the actual license file.
Now the MSI 'knows' it installed the file and removes it upon uninstall (either via (Un)Install MSI or 'Apply Uninstall').

Still why can't I use the persisted 'TARGETDIR' variable when the uninstall is done via '(Un)Install MSI'?
I can use this variable when 'Apply Uninstall' is called.

I see that variable 'declaration' (code region 'Define Setup Globals') is done after the code region 'Check/Install Application Pre-requisites'.
But I assumed that a persisted variable is available from the very beginning of the script.

According to Windows Server 2008 R2 Logo Program I must clean the machine on uninstallation, AFAIK this doesn't work when you use custom actions to install files (and use (Un)Install to clean up)
And while we're on the subject, why doesn't 'Copy/Move Files' accept variables? It's nicer to use that in combination with 'Delete Files' that what I was trying to do (see first post).

As you can see still a lot of questions :wink:. Although the urgency has dropped to level 'not-that-urgent'
Post Reply