1

Earlier we released an application <application name>. Later a new version of the application was released but with different application name <company name> <application name>. But both these applications put files in the same program folder. But we have two different versions listed in uninstall programs.

Now that we want to release a newer version. An we want to uninstall the very first version from the user's pc. how can I achieve this using c#. We are using windows 7 64 bit (application is 32 bit and installed in x86 folder).

I don't have the application setup neither the application key

2
  • doesn't a call to msiexec /u can do the job ? Commented Jun 23, 2011 at 6:30
  • how are these different versions installed? Using msi? Do you know product codes and upgrade codes of the msis? Commented Jun 23, 2011 at 6:36

3 Answers 3

1

If you have an installer project you can specify this in the installer properties.

See: VS2008 Setup Project: Uninstalling the previous MSI

Sign up to request clarification or add additional context in comments.

Comments

1

If you're application cannot detect it's early version (Different Name) ,than you probably should delete Data from Places where these 2 Application interferes . You could do that with File.Delete(); but if these Files are somewhere where Application has not permission's you should force it run as Admin by Adding a Manifest File and replace that line.

 <requestedExecutionLevel level="requireAdministrator" uiAccess="false" />

Comments

0

Have a look at the COM WindowsInstaller classes. You will need to add a reference to the WindowsInstaller class to get access to it. From here you can browse the MSI and perform actions on it if required. I use this in my post build to modify the archive to fix a... undocumented functionality of Visual Studio.

// Create an Installer instance   
MsiInstaller = Activator.CreateInstance(Type.GetTypeFromProgID("WindowsInstaller.Installer")) as WindowsInstaller.Installer;
// Open the msi file for Read/Write   
MsiDatabase = MsiInstaller.OpenDatabase(MsiFile.FullName, MsiOpenDatabaseMode.msiOpenDatabaseModeTransact);

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.