954,518 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

How can I add an uninstall file to the setup project in C#?

when i make a setup file of my project and install it on a computer there is no uninstall file in my application folder , and I can only unistall it from ADD\REMOVE PROGRAMS , why can i add that?

ebiemami
Newbie Poster
11 posts since Jul 2008
Reputation Points: 10
Solved Threads: 0
 

It's already exist. if you go to add\remove program you'll find it + if you install the application and RErun the install file it gives you an option to uninstall the application. All in all nothing called uninstall file. uninstall option by default in install project.

Ramy Mahrous
Postaholic
2,196 posts since Aug 2006
Reputation Points: 480
Solved Threads: 276
 

I borrowed the steps from another forum:


Ø Create an Uninstall.bat file containing:
C:\WINDOWS\system32\MsiExec.exe /I{productcode}

(Path depends of your Windows version, check where your system32 folder is located.. you can also use %systemroot%\System32\msiexec.exe)

(You’ll find the productcode in Visual Studio.NET > Tab Properties in the setup project you’ve just created)

Ø Open the setup project in Visual Studio.NET if you closed it

Ø Add (right-click in Application Folder):

· Add > Project Output > File > Uninstall.bat

· Create New Shortcut > Application Folder > Primary Output (enter a name)

· Create New Shortcut > Application Folder > Uninstall.bat (enter a name)

· Add > File > add .ico files you want to use for the shortcuts

Ø Shortcuts properties > ‘icon’ property (use the icons you’ve just added)

Ø Move the shortcuts to User’s Desktop/User’s Programs Menu (you can also create subfolders)

Ø Build > Rebuild ’name project’

sknake
Industrious Poster
4,954 posts since Feb 2009
Reputation Points: 1,764
Solved Threads: 735
 

please mark this as solved.

serkan sendur
Postaholic
Banned
2,062 posts since Jan 2008
Reputation Points: 854
Solved Threads: 127
 

sa
Ramy , Can u please show what u mean by code ??

farag
Junior Poster in Training
61 posts since Feb 2008
Reputation Points: 7
Solved Threads: 2
 

Open a new notepad
write the following code

@echo off
msiexec/x {product code}

save it as my_name.bat
anywhere in ur pc.
then double click on it and program will be uninstalled.

Note- you can find the product code of your program when you are making the setup file of your project then you can have it in the properties of your setup.

blindprogrammer
Newbie Poster
1 post since May 2010
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You