When try installing our package, if old version already exists in the application folder, an error occur. In this case, we uninstall it from Windows and install new package. I want to delete existing package before we install new package. I want to do this from PowerShell script.
Could you please tell me what the encountered error is here?
Also, is there a specific reason you want to do this through PowerShell?
I am asking this because the default behavior of Windows Installer does exactly what you need.
If you want to remove an older setup, all you have to do is:
- go to "Product Details"
page and increase the version (e.g. version 1.0.0 becomes 1.0.1)
When doing the above, you will be asked to change the ProductCode
- change the ProductCode
I've looked into the PowerShell Automation document but couldn't figure out how to do in PowerShell script.
Please note that the "PowerShell Automation" feature is intended to help automate the creation of your project through PowerShell (e.g. creating a new Advanced Installer project, adding files to it, setting icons, etc.).