Have you received the error message from the attached screensot?
This dialog can only occur on development machines.You needn't consider preventing it on clients machines. Please take a look on this F.A.Q. regarding this subject: Why do I receive the "Another version of this product is already installed" message?
Your scenario could be implemented using major upgrades Windows Installer feature : Windows Installer Upgrades
Also, for enabling the downgrades you have to implement custom upgrade rules. The default Windows Installer behavior when you try to install an older version of an installed package is to prompt the user and to interrupt the installation.
This is the complete implementation:
1. Go to the "Upgrades" page and select "Customize Advanced Installer upgrade rules". Two rules will be displayed in the "Upgrades" section.
- double click on the first rule and modify it in the following way: in the "Versions o upgrade" field, Min version enter "1.0.0" and in the max version enter a large value that your package will never exceed, for example 100.100.100"
- double click on the second rule and modify it in the following way: in the "Versions o upgrade" field, Min version enter "100.100.100". The "Max version" field should be left empty
2. Create a backup copy of you .AIP file - this will be the old version
3. Edit the project as you wish in order to configure the new version.
4. Go to "Product Details" page and increment the "Product Version". When leaving the page you will be prompted if you want to generate a new Product Code. You have to select "Generate New"
5. Build the project
In this way when one of the versions is installed and the setup of the other one is launched, it will first uninstall the other version and then install the version of the launched package - this could be either an upgrade or a downgrade. Also, if the same version of the package is installed launching the package will trigger the maintenance mode.