Web setup project removes files after upgrade from VS2008 to VS2010 - visual-studio-2010

I have a web setup project built using VS2008. I've converted my solution to VS2010 and now when I build my new installer and run the install from the MSI it installs fine, then at the last step, removes all the files it's just installed.
I have RemovePreviousVersions set to true. If I turn this off the files remain in place (but I get multiple instances in the Programs and Features in the control panel).
If I run the install again, the files reappear. From then on, the files always remain, even when installing another version. So, the problem seems to be with running an installer built using VS2008 and then running the same installer built by VS2010. The upgrade GUIDs on each installer are the same.
What is the cause and how can I fix this?

I haven't tried porting a setup from VS2008 to 2010, but having the same upgrade code for different build versions will cause problems; simple explanation is the msiexec installer fails when it tries to remove the old components because the older components have the same upgrade version as the newer components being installed. There is a VS project setting where you can automatically generate a new upgrade code each time you rebuild your .msi; I generally select this and saves a lot of these versioning headaches.
Uninstall all copies of your app using
add/remove programs
Delete the contents of your %TEMP% folder ( to
get rid of any "old" (VS2008) copies
of your .msi)
Update the GUID for the VS2010 version (I think you do this by right clicking on the
GUID in the properties window and clicking "genereate new GUID")
rebuild the project and try again!

I just encountered this error. Had the exact problem when upgrading. I tried the solution at:
https://connect.microsoft.com/VisualStudio/feedback/details/559575
I edited my MSI-file in Orca resequenced RemoveExistingProducts right after InstallInitialize (sequence number 1501). This was found in the InstallExecuteSequence table. This was originally sequence number 6550.
That solved my problem.

What I've discovered is that changing the UpgradeCode will prevent the files from being removed, however it's then treated as a separate installed program - i.e. in the control panel (Programs and Features) my program appears twice. Logically, I think, this is because it's not the same program.
My only option seems to be to programmatically uninstall the old version in the installer of the new version by writing a custom action.

I've submitted a bug to Microsoft Connect and they've confirmed it's reproducible.

Related

Visual Studio Setup Project deletes just upgraded files

I'm working on an old Visual Studio 2008 project which had a setup project. I have upgraded everything to VS2019 made the changes in the code, increased the version, added a few files and made the setup.
A clean install is working perfectly.
When I first install the old version using the setup build in VS2008 and then run the new setup to upgrade this, things go freaky.
The new setup will install all new files, and just before ending it removes all files that were overwritten. Only the files that did not exist will remain.
For example, the old setup places these files in the program file folder:
- program.exe v1.0
- lib.dll v1.0
Then the new setup will install these files, overwriting the old ones:
- program.exe v2.0
- lib.dll v2.0
- other.dll v1.0
- info.txt v1.0
Just before ending the install and enabling the [close] button, the folder contents changes to:
- other.dll v1.0
- info.txt v1.0
I have checked this on multiple computers (Win 10 down to Win 7) and used a filemon tool to make sure that the new files are actually installed and then removed. The Event log only shows a successful install.
Starting the new setup again and choosing 'repair' will work and leave the files. So that is a workaround, but not the nicest one for many users.
A test with two VS2019 setup builds with different versions work correctly. The old VS2008 setups also worked correctly. So it appears to be an issue when upgrading a setup build with VS2008 with a setup build with VS2019.
Does anybody know how to fix this so that installation does not remove the files?
Okay, I had seen some VS2010 questions which looked the same. Solutions there seemed to be manually editing the msi file after the build. Far from optimal and I would assume that it was fixed by MS in VS2019.
Turns out that they have not "fixed" it, but allows Backward Compatible IDs to be used. I suddenly saw this option when going through the options panel again. Change to True:
And this does solve my issue.
More info in this answer
This question can be deleted if someone thinks it's a duplicate. When you think it's helpfull I'll accept my own answer here for archive sake.

VisualStudio 2010 setup project to InstallShield seamless transition

I just installed VS2013. As there is no longer the Setup Project, I installed InstallShield LE. I used integrated import wizard and hoped any newer build would automatically update older versions created with VS Setup project. Well, I used to alter the Product Version, which prompted me to alter the Product Code, and that was it. Now I thought this should work with InstallShield as well, so I updated the product version and manually generated the product code. I had the older application installed and tried to reinstall it with this new IS LE setup. And the result is: There are two applications installed, which have exactly the same name and path (it installed in the same directory), but different version. I can really see 2 programs with the same name in "Programs and Features". I checked the upgrade code, it is the same for both. What did I do wrong?
Thanks
Check the installation type, i.e. per user or per machine. It must be the same for both versions, otherwise Windows Installer will skip removing the old versions and you will end up with both versions on your machine.
A verbose log created when you install the new version should also be helpful, you can search for FindRelatedProducts and RemoveExistingProducts standard actions in it, to see why the old version is not removed.
Well finally we were able to solve the problem. You need to place an entry to the Upgrades Path section. Oddly enough You need to do this manually and it's not done automatically by the IS import wizard.

VS 2010 Setup Project is NOT removing previous versions

I am using a setup project in VS 2010 to install a windows form application I have created. The setup project works great, however, if I update the application and change the version number and upgrade code of the setup project it does not update the application on the user's machine when the setup project is run again. It will go through the install steps and say that the installation was successful, however, the application that is on the user's computer remains exactly the same and is not the newer version. Oddly enough, if you were to run the setup project again an error will come up saying that this version of the application is already installed and that you must use the add/remove programs to remove the current version to continue with the installation. Has anyone else experienced this issue before. I have heard that this may not be possible using the setup project in VS 2010, but I am hoping that is not the case as this method has worked great for me with the exception of this issue.
You should not be changing the UpgradeCode property, this will have exactly the effect that you are seeing:
Caution
The UpgradeCode should only be set for the first version; it should never be changed for subsequent versions of the application, nor should it be changed for different language versions. Changing this property will keep the DetectNewerInstalledVersion and RemovePreviousVersions properties from working properly.
( via https://wayback.archive.org/web/20121029130031/https://msdn.microsoft.com/en-us/library/465253cd(v=vs.100).aspx )
Assuming you want to remove the old version and replace it with the new one (as opposed to having them installed side-by-side, which is actually what you're doing) you should change the Version (of both the MSI and the file(s) being updated) and the ProductCode (of the MSI) and set RemovePreviousVersions to True.
I encountered same problem.
and I resolved with changing those four.
(I used Visual Studio Community 2019)
[setup project]
・Version
[.Net project]
・Assembly Version
・Assembly File Version
・GUID

Visual Studio: How to automatically uninstall previous installed version?

I have a simple Web Setup project that reads from a Deployable Project.
Even though I have set the Setup to DetectNewerInstalledVersion to false I always get that annoying alert box that a previous installation exists and I need to go to the Control Panel and find the software to remove it...
Is there a way to add a script in a new new installation Dialog that could say A previous version was found, press NEXT to uninstall it. ?
Older versions are uninstalled automatically if you increase your Product Version and change the Package Code. This needs to be done each time you modify the setup project and build a new package.
If you keep the same version and Product Code, older builds cannot be uninstalled automatically. They are detected by Windows Installer before your new package is actually launched. So you need to uninstall them manually.
In my case I found out that the setup project wasn't part of the configuration manager.
Therefore, it wasn't rebuld on solution rebuilds and setup file with the new version and ProductCode wasn't generated.
The solution is simply to right click on the setup project and click rebuild.
Hope this help to future readers :)
The answer is not to use the Visual Studio setup project that's already integrated. I'm having the exact same problem: it won't remove previous versions even though I up the version, set it to remove previous version, check for previous version and rebuild, I can install but the files aren't updated. There are some good tools for this out there, check out bitrock, inno setup or wix.
Also Visual Studio 2010 was the last version with setup project support. It's not included in 2012.
I struggled with this for a long time but it is very simple.
Go to manage VS Extensions (VS2019) and install 'Microsoft Visual Studio Installer Project' v0.9.9
Right click on your installer project and go to properties. Keep the UpgradeCode variable in the properties window the same for different versions of the same product.
Change your ProductCode variable between different builds.
Now when you install the product with the same UpgradeCode already on the system, the installer will upgrade your existing product and you will only have one program in the Add/Remove window.
Create a .bat file
Write this code:
wmic product where name="SetupProgramName" call uninstall /nointeractive
cd Debug
setup.exe
Put this file in installer directory.

windows installer custom action install & uninstall both called when upgrade

Excel AddIn, VS2010, C#, Windows Installer
VS2010, Setup project, RemovePreviousVersion: True, DetectNewerInstalledVersion: True, InstallAllUsers:True
I have some install, uninstall codes in Custom Action
When I do a upgrade install, I notice, install is called first, which installs newer version, and then uninstall is called, which uninstalls the newer version. The end result is not-working AddIn left.
If I do a new install (i.e. no earlier version of AddIn), then only install is called and addin installs successfully
Installer used to work fine when I built it in VS2008, and I just converted projects to VS2010 and then the issue comes up.
Anyone know why ? thanks
You likely have RemoveExistingProducts scheduled incorrectly - I don't know if this can be changed in VS Setup Packages, but that will be the action that is causing all your pain.
I already answered in comment under my question. Now answer it explicitly for convenience in search.
I edited my MSI-file in Orca resequenced RemoveExistingProducts right after InstallInitialize (sequence number 1501). This was found in the InstallExecuteSequence table. This was originally sequence number 6550.
Pls refer Web setup project removes files after upgrade from VS2008 to VS2010

Resources