views:

478

answers:

0

I am writing a service that will run on a machine to push and pull files from one location to another. I want to create an installer that will allow the user to name the service during setup (and description later.) I found this post (http://stackoverflow.com/questions/1070885/specify-windows-service-name-on-install-with-setup-project) that describes how to do this. However the user (admin) needs to be able to run the installer more then once to name the service for three different environments. For example:

The admin needs to have two test environments that use the same machine, but run the service as two separate instances pointing at two separate configuration files.

I have setup the projects as follows:

  • I have a windows service written in .Net 2.0 which has a reference to all code logic (in a separate class library)
  • I have a setup project written in .Net 2.0 which has the service added as a project output. I have then also added the custom actions to this installer that name the service, and install it under that name.

My intention is to create one MSI that the admin can install as many times in different directories with different service names. I do not want to have to generate a new MSI with a new product code each time he wants to go to a new environment.

Currently with the setup that I have it will name and install the service to the location selected as I would expect, but when I try to run the MSI again it attempts to remove the previous version, or asks me to repair or remove the currently installed version. I have set the Deployment Project Properties to not detect newer installed versions and not remove previous versions.

Is there any way to set the Project Installer to install to wherever I point it to without looking for a previous version of the project?