Persisted variables and upgrades
Posted: Tue Feb 01, 2011 5:49 am
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?
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?