Thursday, July 24, 2008
I was trying to add an uninstall button to a setup project such that, when a user installs the application the uninstall option will also appear in the programs menu of user. The setup project was in vs.net 2003.
There was no direct way i found, two ways that came by googling
a. making a bat file that will uninstall the application
1. Create a "Uninstall.bat" and include the following line:
msiexec /x {your product code}
(Replace the "your product code" with your product code GUID.)This product id is found by going into the properties of the setup project
2. Add the BAT file to your application folder of setup project.
3. Add a shortcut in Users Programs Menu that points to the BAT file.
4. Set the "ShowCmd" property of the shortcut to "vsdscMinimized".This will minimize the bat window which sometime may feel annoying.
You can do other staffs like adding icon and rename it according to your needs. This
More info
b.Another way was to make a project that uninstalls application, this was a simple c# project
This is how they did it.
1. Create simple project UninstallApp.
2. Add in Main()
{
string[] arguments = Environment.GetCommandLineArgs();
foreach(string argument in arguments)
{
string[] parameters = argument.Split('=');
if (parameters[0].ToLower() == "/u")
{
string productCode = parameters[1];
string path = Environment.GetFolderPath(Environment.SpecialFolder.System);
Process proc = new Process();
proc.StartInfo.FileName = string.Concat(path,"\\msiexec.exe");
proc.StartInfo.Arguments = string.Concat(" /i ", productCode);
proc.Start();
}
}
3. Create new setup project
4. Add UninstallApp.exe to "Application Folder" in 'File System' part
5. In "User's Program menu" create shortcut to UninstallApp.exe and in properties of this shortcut in parameter 'arguments' insert value "/u=[ProductCode]".
6.Rebuild deployment project.
More Info
Labels: setup project, uninstall button
2 Comments:
-
- আলোর ছটা said...
July 27, 2008 at 3:55 PMshimulda, the more i see you, the more i wonder!- Shimul said...
July 27, 2008 at 4:37 PMcopy and paste copy and paste, actually your post was just in time when i was looking for a setup project, so u started man