Windows Service Setup Project - visual-studio-2010

I’m trying to create a set-up project for a windows service. I’ve followed this tutorial and many others like it but, after installing my service, I still can’t see the service. I’ve added the primary output of the service to the application directory and created a custom action to include this output on Install, Commit, Rollback and Uninstall.
It claims that it installs correctly.
Should this work? Is there anything else that I can try to get this to install?

Did you create an installer for your service? It is separate from a Setup Project.
See: http://msdn.microsoft.com/en-us/library/system.serviceprocess.serviceinstaller.aspx
You can create an Installer by right-clicking on your service's Design window and selecting Add Installer.

In my case, adding the installer was a first step as described by dhirschl's answer. I then needed to add custom actions to the setup project.
Right click the setup project/view/custom actions
then add the primary output to every folder there.
Source

Related

Service not removed after uninstall the application

I have created the setup of window form application using visual studio setup project.
It install fine and works fine my application.
But when i uninstall the application it uninstall properly without any error, but the service of the application does not remove from services.
I don't know why this happens.
Please somebody help me. thank you in advance.
I have a same issue in my application.
I just add the window restart code in installer class, so when i uninstall the application system restarts and application process & service both have removed.
There are a few possible reasons for this:
You did not add your installer class to every node of the custom actions list in your setup project. In other words, maybe there is no uninstall custom action so the service won't be uninstalled.
If there is an uninstall method, it will typically not stop your service unless you do that, by adding shutdown code to an override, before base.Uninstall(). That means it will attempt to uninstall it, probably mark it as Disabled in the services applet and remove it at the next reboot.
You might be using Installer classes (without using custom actions) and trying to run InstallUtil.exe. This is not the right way to do it, but if you didn't run it as uninstall custom action then you haven't uninstalled, and number 2 still applies. Finding InstallUtil.exe to do this is not safe anyway.
Having said that you still haven't been explicit about how you used installer classes, if they are custom actions, or if you're running InstallUtil.exe, if there is an uninstall custom action, and what is the exact state of the service after the uninstall.

Setup project always clean installation

I have a setup made by Setup Project for my application. Is there a possibility to make my setup not check for any installed versions of a product?
I want it to work in this way: whenever I open my setup I want it to do a clean install. I don't want to have any repair option, but I want it to allways overwrite the installed product.
Is there a possibility to achieve it in Windows Installer? Are there any properties I could change in Orca to achieve it?
Thanks a lot for any help!
You would need to stop registering the package with Windows Installer. To do that you need to remove the following standard actions from InstallExecuteSequence table:
RegisterUser
RegisterProduct
PublishFeatures
PublishProduct
Just so you know, this will also make the product to not be listed in Control Panel, list of install programs.

How to delete application file from AppData\Roaming folder

I am using windows installer to create setup project.
How I can remove/delete application files from AppData\Roaming folder when application uninstalled.
I tried added a special folder and set DefaultLocaltion to [AppDataFolder] but it didn't working.
Do I need to do anything else?
I'd need to understand what you are trying to do to give you specific advice. In general what you are trying to do would be OK removing files from CommonAppDataFolder but not AppDataFolder as trying to clanup user data from multiple user profiles is not a best practice. Additionally trying to cleanup Roaming Profile User data is outright impossible because the other users aren't logged on.
You'll want to read:
Managing Roaming User Data Deployment Guide
Assuming you are trying to do what I think you are, you'll need a cleanup script / exe that you leave behind on uninstall and a custom action to write to the registry during uninstall ( MSI can't do this natively ) to call that script/EXE. You'll want to leverage the Active Setup trick as described here:
Using Active Setup to Repair User Settings
The way it'll work is your uninstall leaves the EXE and registry entry behind so that when a user logs on it's roaming data gets pulled down from the server to local and Active Setup realizes it hasn't run the script yet. The script runs (once) and the data is deleted. When the user logs off the data is replicated / deleted on the server. Then they log on again it doesn't run again.
By default Windows Installer does not remove the files created by your application, after the installation. To do that you need to either write your own custom action, that will run upon uninstall, or depending on the tool used for authoring the MSI, you can use built-in options for cleaning the application locations, as some tools have this support.

How do I add CRRedist2008_x86.msi to Visual Studio Deployment Project?

I need to add CRRedist2008_x86.msi to my deployment project as it is a requirement for my app. However, I want it to run automatically. I don't want it to be just added as a file and then the user has to click on it for it to run after my app installs. Can someone guide my on how to do this? It seems like it should be very easy but for some reason I am missing something.
What you need to do is set it up as a "merge module" in your deployment project. Instead of the .msi, find the.msm file that should be available on the CR website. Then in your deployement project, right click the Project and select Add->Merge Module. Browse for the file and you are set.
When the installer runs, it will automatically unpack the crystal reports related items and install them for you. You may also need a key file, depending on the licensing of the application involved.

Run another installer in an Inno Setup installation

My company is developing an application that has a dependency on another of our applications. That second application already has an Inno Setup installer.
So I think I'd like to bundle the second application's installer within the Inno Setup installer for the first application. But I'm not sure how to go about that properly. Does anyone know the "right way" to do this?
I found this: Inno Setup Knowledge Base—HOWTO: Install .MSI files. I assume the technique could be used for a nested Inno Setup installer. But I have a couple of questions about the fine details:
How could I make it so if the first application is uninstalled, the second is also uninstalled?
Is that a sensible thing to do (automatically uninstall the second application), or should I leave it to the user to do that manually?
If the user tries to uninstall the second application while the first is uninstalled, should I somehow detect that and give a warning? How could I do that?
For the level of uninstaller functionality you are talking about, I suggest you get familiar with pascal scripting in Inno Setup (if you are not already). It offers incredible customisation, but has the caveat of making your projects a lot more complex.
To answer your third question first:
Yes, you should do this. In order to do it properly, you need to add this functionality to the uninstaller of the second application (i.e. the one your app is dependent on). See Uninstall event functions in the Inno Setup help. You need to check in that uninstaller if your app is installed (by checking if HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\SecondAppName exists, for example) and in that case show an additional warning.
As for your second question:
If it is remotely possible that your customer wants to continue using the second app, even if he decides that he wants to uninstall the first one, you should offer him the choice. I would do this with a seperate wizard page in the uninstaller for your app, after your app is uninstalled.
And finally, your first question:
You need to determine the name (full path) of the other app's uninstaller exe. You can retrieve it from the registry key HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\SecondAppName\UninstallString. For executing it from a script in the [CODE] section, see Exec in the Inno Setup help.

Resources