how to make a uninstall option in C# program? - visual-studio-2010

i want to make a uninstall option in my C# program?
can u help for this?
and provide some code also

If you deploy your application via a Visual Studio Setup and Deployment Project, an uninstaller will come standard with the installation. It will be available in the Add/Remove Programs of the control panel.

You can create an installation project which will automatically add support for uninstallation. Under Other Project Types you have Setup and Deployment. There is InstallShield LE and Visual Studio Installer. If you choose Setup Project under Visual Studio Installer project, you will have uninstall as part of the built project.

see this video
http://www.youtube.com/watch?v=Z-xFLltALg0
If you want the executable to remove itself. aka self-destruct. Check out this blog http://blog.pedroliska.com/2010/05/20/c-self-destruct-windows-app/

Related

How to make Project installation setup like VS 2012?

Today i installed vs 2012, I have seen the installations setup is very nice. Is any possibility to make Project installation setup like VS 2012?
Actually, I think that setup is built with WiX, as a bundle that wraps several separate MSI files, and with custom bootstrapper UI. I think there's a vdProj to WiX converter that creates a WiX install file, but I've not used it.
You can use the Laika42 Themed Boostrapper:
http://visualstudiogallery.msdn.microsoft.com/6e84def3-9f27-4292-aa3b-3ec542338e4a
Update:
Just found out that this product has got a new name Visual Installer. Product site is here.
Screenshot:
do you wish to create these kind of windows or are you searching for an app, which wrapps your setup (like installshield....).
if the first one: http://msdn.microsoft.com/de-de/library/windows/apps/hh986965.aspx

How do I create a wix3.5 installer to check for VS2010 and install it if its not installed

In my installer I need to check whether VS2010 is present on the machine while I run the msi. If its not present, I need to provide a link to install VS2010.
How to accomplish this?
For this purpose you can use one of the properties defined in the WiX Visual Studio extension.

How can I install a VSIX package automatically, with WIX?

I've got a WIX installation project for my application. As part of my solution I have a VSIX extension, that I want to install on the customer's Visual Studio.
What I don't know, is how to get WIX to automatically initiate the VSIX importer.
I tried following the advice on MSDN (How to: Prepare Extensions for Windows Installer Deployment as well as Installing a VSIX as part of a Larger installation), to no avail. Neither included guidance for WIX projects.
Any help will be appreciated.
WiX v3.6 supports the VsixPackage element to directly manage VSIX packages.
This can be done through a custom action which launches VSIXInstaller.exe with the appropriate command line. There is a discussion about this here: http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/VSIX-after-installation-td4975318.html
Perhaps this will also help: http://blogs.clariusconsulting.net/pga/deploying-a-vsix-from-a-msi/

How can I create an MSI setup?

I've created setups for all my Delphi tools with Inno Setup for years. Now some users rather want an MSI installation package, so they can deploy the setups from a central server to all workstations.
How do I create one? Do I have to buy Visual Studio or some other product?
You can use Wix (which is free) to create an MSI installation package.
WiX Tutorial - Creating an Installer MSI with Wix
If you don't understand Windows Installer then I highly recommend The Definitive Guide to Windows Installer. You can't really use WiX without understanding MSI. Also worth downloading is the Windows Installer 4.5 SDK.
If you don't want to learn the Windows Installer fundamentals, then you'll need some wizard type package to hide all the nitty gritty details and hold your hand. There are plenty of options, some more expensive than others.
InstallShield
Advanced Installer
MSI Factory
etc..
However still I'd suggest picking up the above book and taking some time to understand what's going on "under the hood", it'll really help you figure out what's going wrong when customers start complaining that something is broken with the setup :)
You can use Visual Studio - that's paid.
You can use https://www.advancedinstaller.com/ - that has a free edition.
You can use http://nsis.sourceforge.net/Main_Page - for example Winamp uses this installer - and is very configurable and is Open Source.
Google "Freeware MSI installer".
e.g. https://www.advancedinstaller.com/
Several options here:
http://rbytes.net/software/development_c/install-and-setup_s/
Though being Windows, most are "shareware" rather than truly free and open source.
In Visual Studio (including the free community editions) you can install the Microsoft Visual Studio Installer Projects extension [1] which allows you to create an MSI installation package. To install it from within Visual Studio:
Go to Extensions -> Manage Extensions in the menu bar
Search for Installer Projects in the search box
Select Microsoft Visual Studio Installer Projects and hit Download
Restart Visual Studio
Once the extension is installed, you'll create a new project that will contain all of the files and settings for the MSI. To do this:
Go to File -> New -> Project in the menu bar
Change the drop down menus visible to show All languages, All platforms, and All project types respectively
Scroll down in the project type list and towards the bottom select Setup Wizard: Create a Windows Installer project with the aid of a wizard.
Hit Next.
Work through the prompts to choose the installer project name and location. Choose Create a setup for a Windows application at Step 2 and in Step 3 choose the executable and other files that should be included in the MSI (hit Add..). At the end, hit Create.
To build the actual MSI go to Build -> Build Solution in the top menu, and you should see a message like the following in the Output window:
Build started...
------ Starting pre-build validation for project 'Setup1' ------
------ Pre-build validation for project 'Setup1' completed ------
------ Build started: Project: Setup1, Configuration: Debug ------
Building file 'C:\Users\zelda\Source\Repos\Setup1\Setup1\Debug\Setup1.msi'...
Packaging file 'test.exe'...
========== Build: 1 succeeded or up-to-date, 0 failed, 0 skipped ==========
What's created by default is a very basic MSI, but for additional configuration like creating custom actions, adding/changing registry keys, configuring the user interface associated with the MSI, etc., see the full documentation [2]
[1] https://marketplace.visualstudio.com/items?itemName=VisualStudioClient.MicrosoftVisualStudio2017InstallerProjects
[2] https://aka.ms/vdproj-docs
You can use "Visual studio installer project" and its free...
This is very easy to create installer and has GUI.(Most of the freeware MSI creation tool does not have a GUI part)
You will find many tutorials to create an installer easily on the internet
To install. just search Visual Studio Installer Project in your Visual Studio
Visual Studio-> Tools-> Extensions&updates ->search Visual Studio Installer Project. Download it and enjoy...
Look for Windows Installer XML (WiX)
You can purchase InstallShield, the market leader for creating installation packages. It offers many features beyond what you get with freeware solutions.
Warning: InstallShield is insanely expensive!
In my opinion you should use Wix#, which nicely hides most of the complexity of building an MSI installation pacakge.
It allows you to perform all possible kinds of customization using a more easier language compared to WiX.

Installing a windows service from a Visual Studio Installer project

A colleague has written a Windows Application and left me to do the installers. I have created the installer project through Visual Studio and added the primary output of the service project to the new project.
When I run the installer it creates the correct folders and copies the dlls, exe and config file in, but it doesn't do the actual install of the service.
The service isn't listed in the Services window, and if I double click on the exe I'm told I need to run installutil to install the service.
How do I make the installer do this bit for me? I found this article:
http://www.codeproject.com/KB/install/InstallService.aspx
but that seems overly complex for what I would expect to be pretty basic.
I used this article:
How to create a Setup project for a Windows Service in Visual Basic .NET or in Visual Basic 2005
Felt pretty dumb that I couldn't figure it all out until I went through all of the steps in this article. It's not a trivial exercise by any means.
For those who are looking for updated instructions for Visual Studio 2010 (instructions in answer are for VS 2005) check the following link:
Walkthrough: Creating a Windows Service Application in the Component Designer (note that "other versions" [VS 2005, VS2008] are available from the same link)
I had this issue in my case the problem was I neglected to add the custom actions for the installer project. To find these right click project->"view"->"custom actions" under there it needs the primary output added to the folders.

Resources