If you migrate a Setup project from Visual Studio 2008 to Visual Studio 2010 and set the property RemovePreviousVersion=True, The upgrade package removes the application folder once it is installed.
This issue occurs because the Component GUID’s are changed when setup projects are migrated from Visual Studio 2008 to Visual Studio 2010. InstallValidate Action marks components to be installed locally, RemoveExistingProducts that runs at sequence 6550 ends up removing those components.
There are two solutions:
1. Manually change the component GUID’s to be the same as that of VS2008
2. Re-sequence the RemoveExistingProducts Action right after InstallInitialize (sequence number 1500+). This ensures that older files are removed and reinstalled by the newer version.
The second solution can be achieved by running a post build script OR manually editing the MSI package using Orca.exe(It comes with Windows SDK).
You can add the below text into a file next to your .vdproj called "fix.js", and then set your "PostBuildEvent" property to exactly the following string, to run it after every build – cscript.exe "$(ProjectDir)\fix.js" "$(BuiltOuputPath)"
var newSequence = 1501;
var msiOpenDatabaseModeTransact = 1;
var msiViewModifyReplace = 4
if (WScript.Arguments.Length != 1)
WScript.StdErr.WriteLine(WScript.ScriptName + " file");
var filespec = WScript.Arguments(0);
var installer = WScript.CreateObject("WindowsInstaller.Installer");
var database = installer.OpenDatabase(filespec, msiOpenDatabaseModeTransact);
WScript.Echo("Updating the InstallExecuteSequence table…");
sql = "SELECT `Action`, `Sequence` FROM `InstallExecuteSequence` WHERE `Action`=’RemoveExistingProducts’";
view = database.OpenView(sql);
record = view.Fetch();
if (record.IntegerData(2) == newSequence)
throw "REP sequence doesn’t match expected value – this database appears to have been already modified by this script!";
if (record.IntegerData(2) != 6550)
throw "REP sequence doesn’t match expected value – this database was either already modified by something else after build, or was not produced by Visual Studio 2010!";
record.IntegerData(2) = newSequence;