Hi all,
I have a Windows Service project, and an Installer project to create a .MSI for it. I'd like for the MSI to install the service after it is done installing the project. I think I need to do this with a Commit Custom Action, but cannot figure out how.
Seems like this should be easy, and common, right
Thanks for any input.
Cheers,
Chris

Install service via Installer
Jimbo1199
Stijn Lambert
not sure if you still need this but i eventually worked it out.
add an install package project to your solution.
add to this the the primary output from yourt service.
right-click the setup package project, choose View --> Custom Actions
add the Primary Output from the service project under each of the headings... Commit, Install, Rollback etc.
ASP-SQL Newbie
Sorry, I should have said - from memory you just need to add a custom action to the install action set to the primary output of the project/the file with the installer in.
I don't have my projects to hand on this computer, but I don't think you need to set up commit, rollback or uninstall actions: these are automatic.
James Lett
Regards,
Thomas
[1] http://pluralsight.com/wiki/default.aspx/Craig/SelfInstallingService.html
James M - new user
Thanks for the reply. I already have a service project with the Service and Process Installers in it. The .exe that is built by this project still needs to be installed on the system using InstallUtil.exe. It is this process that I am trying to automate in the deployment Setup Project (the output .MSI).
Am I missing something in what you responded with
Cheers,
Chris
Benson Margulies
You need to create a new service installer, this is a class with the RunInstaller attribute and that inherits from System.Configuration.Install.Installer. This then ads an array of System.Configuration.Install.Installer[] to its Installers property - e.g. - a ServiceProcessinstaller and ServiceInstaller.
If you used a wizard to make the service you can get away with Add Installer with the file selected in solution explorer! Look in the small panel at the bottom of the properties view.
Here's a quick example:
using System;
using
System.Collections;using
System.Configuration.Install;namespace
Example{
/// <summary> /// An example installer /// </summary>[RunInstaller(
true)] public class ServiceProjectInstaller : System.Configuration.Install.Installer{
private System.ServiceProcess.ServiceProcessInstaller serviceProcessInstaller; private System.ServiceProcess.ServiceInstaller serviceInstaller; public ServiceProjectInstaller(){
serviceProcessInstaller =
new System.ServiceProcess.ServiceProcessInstaller();serviceInstaller =
new System.ServiceProcess.ServiceInstaller();serviceProcessInstaller.Account = System.ServiceProcess.ServiceAccount.LocalSystem;
serviceProcessInstaller.Password =
null;serviceProcessInstaller.Username =
null;serviceInstaller.DisplayName =
"My Service";serviceInstaller.ServiceName =
"MyService";serviceInstaller.StartType = System.ServiceProcess.ServiceStartMode.Automatic;
serviceInstaller.ServicesDependedOn =
new string[] { "Netman", "Eventlog", "Workstation" }; //any other stuff goes in hereInstallers.AddRange(
new System.Configuration.Install.Installer[] { this.serviceProcessInstaller, this.serviceInstaller });}
}
}