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?

Dani AI

Generated

is right: with a Visual Studio Setup Project you do not ship a separate uninstaller. The MSI registers itself in Add/Remove Programs (Programs and Features) and uses its ProductCode GUID as the uninstall entry. That is why uninstalling from Control Panel is the standard path. (learn.microsoft.com)

If you still want an explicit Uninstall shortcut (for example in the Start Menu), the reliable pattern is what and hint at: call Windows Installer with your package’s ProductCode. Use the uninstall switch so it removes directly, whereas the install switch opens maintenance mode where the user can choose Remove. Microsoft documents these switches and their meanings. Do not redistribute msiexec.exe; just invoke the system copy from %SystemRoot%\System32. (learn.microsoft.com)

Two practical polish tips:

  • Give your app an icon in Programs and Features by setting the ARPPRODUCTICON property in your MSI (add an .ico to the project and point ARPPRODUCTICON at it). (learn.microsoft.com)
  • Remember that ProductCode is a unique ID for each product release. On a major upgrade Visual Studio will change it, so any uninstall shortcut you ship must be updated each release or it will target the older version. This is by design in Windows Installer. (learn.microsoft.com)

For anyone revisiting this thread on newer Visual Studio versions: if you do not see the old Setup Project type, install Microsoft’s “Visual Studio Installer Projects” extension to keep building .vdproj installers in current VS. (devblogs.microsoft.com)

Recommended Answers

All 5 Replies

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.

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’

please mark this as solved.

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

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.