Noich
Noich

Reputation: 15511

How to deploy multiple applications together

I have the following:

  1. Windows service that I wrote, it is used only by the two following apps:
  2. Client app.
  3. Agent app.

Both client and agent can't function without the service. Our current installation is using ClickOnce (the service is not yet deployed).

What I want:

  1. 2 separate installations - client+service, agent+service. This is because I have many machines that will only perform tasks that clients send them, and they don't need the client. Also, not everyone who wants a client wants to make his machine an agent as well.
  2. Deploy logical packages - it doesn't make sense to deploy only client, for example, because it can't run by itself. It also doesn't make sense to deploy the service by itself.
  3. Maintain versions compatibility - How to handle the following scenario: someone installed agent+service version 1, then installed client+service version 2.
  4. Elevated privileges: is it possible to install windows service on a machine using an account that has elevated privileges, but the current privileges aren't necessarily elevated? Can I make a silent installation?

ClickOnce is very nice but not mandatory. If there are better solutions to meet my requirements, I will switch to them, providing that update is still possible (force update as well as an option to delay update).

Upvotes: 1

Views: 443

Answers (1)

codeConcussion
codeConcussion

Reputation: 12938

I'll address the ClickOnce approach. An msi install might be more appropriate, but it sounds as though you want some sort of auto-updating. It might be easier to force your windows service install into a ClickOnce approach rather than make an msi install self-updating.

ClickOnce, at its core, is simple. It keeps files in a user's profile folder in sync with files on a server. This should work great for the Client and Agent apps. Not so much for the windows service.

For the service I would have ClickOnce deploy the service bits. Then write code that will execute in the Client/Agent to install/update the service.

I've found Topshelf to be pure awesome when working with services. It lets you write a standard console app which makes development easier. Then to install it you can call the console exe and pass an --install switch. I think you could have that code execute whenever the Client/Agent starts and copy files, install/update/start/stop the service, and whatever else is necessary to make your service work.

Now for your numbered list...

  1. Can be handled. Two ClickOnce installs both containing the service.
  2. This should work as long as you can install the service through your own code.
  3. This is more tricky. You have to define what you want to happen. You would be in complete control of the code that installs the service, so you can decide what to do and handle it appropriately.
  4. I'm guessing you'll need elevated privileges to get the windows service installed. That means a prompt from ClickOnce. The only way around that is to sign your deployments then import the certificate on the client's machine. Not really worth it to avoid one prompt, IMHO.

Upvotes: 2

Related Questions