How to install and start a service that relies on an assembly
The following article uses options that are available starting with the Enterprise edition and project type.
Services that rely on the presence of an assembly in the Global Assembly Cache (GAC) cannot be installed or started during the execution of StartServices standard action. If you need to start a service that depends on an assembly in the GAC, you must use a custom action scheduled after the InstallFinalize standard action.
In this example we will use a .bat file for our custom action.
1. Create a .bat file and paste the following code:
net start "Service Name"
The "Service Name" must match the declared "Service Name:" field of your service.
2. Add your .bat file to the project as a temporary file.
3. Select your service control operation from
the Services Page and uncheck the "Start"
checkbox in "Event on Install" field.
4. Go to the Custom Actions Page and add a "Launch file" custom action
with sequence after "Install Execution Stage -> Finish
Execution" action group. In the File to launch field
add a reference to your temporary bat file.
5. Build your project
and run it.