I am developing WPF application in C#. Currently my msi install the current application in machine.I need to check any existing version installed and remove the existing version installed in the machine and install the new one.
Can any one help me how to check the installed application in the machine and uninstall that before installation of my new msi.
You could do it by properly configuring MSI properties. Click on Installer project and press F4 to view MSI's properties window.
When you go to properties you could see two type of properties that are Upgrade code
and Product Code
. Every Time you create/release a new installer package make sure to keep the same Upgrade code but change the Product Code.
Change DetectNewerInstalledVersions
property to true
.
Set RemovePreviousVersions
to true
.
Now Change the version
number to a higher version from previous release, if your previous release version was 1.0.2, change the new version to 1.0.3.
When you install a MSI with abovementioned settings, MSI will check if any other product installed with same Upgrade code, if it finds a product then it will check if the new installation has a higher version. If all the conditions are satisfied it will first remove the existing(Older) version and install the newer version.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With