views:

120

answers:

4

Here's my current scenario which is specifically what i'd like to discuss as a case study, however I want this to be open enough to address other deployment practices for .NET projects.

I have a .NET WPF Application written to perform manufacturing functional tests. Currently this software is deployed by copying the executable and it's dependancies to the target system. The slave communications systems are installed similarly, but installutil needs to be used to register a WCF windows service. This is all being done manually. Furthermore, configuration files are being read from custom xml data sources that are local to the application folder. No app.config is being used.

I think we can all agree this scenario is sub-par, and definately fails to even come close to an ideal launch condition

My questions are as follows:

  1. What should be used for setup and deployment? Setup and Deployment Wizard? Click-Once Deployment?
  2. How should I go about automating the installation of the windows service? Best way to specify custom username/password for the afforementioned service?
  3. What should be done about configuration if mutable application folder storage is considered harmful, how should I go about this? Isolated Application Storage?

Article links for any of the above would be ideal.

+1  A: 

Yeah, 1, a Setup and Deployment project, easy peasy. How to configure the setup project to install the service with a custom action is described in detail in the "Creating a service application" walkthrough.

Hans Passant
anything on the rest?
Firoso
It is just copying files. Press F1.
Hans Passant
+3  A: 

I can't really address all of you're questions, but to at least help with a portion of the problem I have experience with.

I found on a forum post, how to basically integrate InstallUtil into you're program, be basically doing what it does for you to install the service, since it's all built into .net. So what the original forum poster did, and I've replicated myself into one of my base libraries, is basically if I want to create a service, I just create a console application that extends ServiceBase, override OnStart / OnStop and have all of my service code. This is great because it allows me to debug right from Visual Studio, and then installing as a service just means running consoleapp.exe --install, and it'll run through everything that needs to be done to install the service.

However, for configuration and deployment itself, I'm still limited to doing a build, and just copying all the updated files to the server as required, and leaving that particular servers configuration file intact. I'm a large proponent of using version control for configuration files per server, and I'd really just write a script to copy the requires files between systems if you need to do it on alot of servers, but as stated I don't have alot of experience with this. I hope integrating the service installer is helpfull though.

I believe this is the link to the original forum post for writing you're own installer

Since you mentioned WCF, though I would include this link about doing WCF from a Windows Service

Kevin Nisbet
+2  A: 

(1) What should be used for setup and deployment? Setup and Deployment Wizard? Click-Once Deployment?

If you really want minimize risk of any deployment stuff ups due to human error, I'd be using WIX (http://wix.sourceforge.net/) to create separate msi installers for both the client WFP application and the windows service. WIX can be quite painful at times, but pretty much anything in terms of deployment can be achieved. There is a special WIX visual studio project available once WIX has been installed on your PC.

Enterprise IT guys I have worked with in the past have successfully used SMS or Active Directory to install any msi's I have created for them in the past using WIX rather than click-once. This really has nothing to do with WIX though.

(2) How should I go about automating the installation of the windows service? Best way to specify custom username/password for the afforementioned service?

There are many articles on the web explaining how to install a windows service using WIX such as this one - Installing and starting a Windows Service using WiX. Using WIX you can set custom username/password parameters to be provided at install time. These parameters can be set via an MST file, or via the commandline using the msiexec.exe command.

(3) What should be done about configuration if mutable application folder storage is considered harmful, how should I go about this? Isolated Application Storage?

Using WIX, mutable configuration files can become a thing of the past as xml config settings files for various environments including production can live in separate MST files controlled by system administrators only. Added security for passwords and the like that live in secure key-safe repositories, these can be added via the commandline as described in the previous answer.

The settings parameters are passed at install to time to generated various configuration files that can then be set a readonly or even encrypted - Using WiX to fix up XML files when deploying to different environments.

Bermo
If using WiX for the service installation, and the installation fails, try to turn off automatic startup of the service. The project I'm on moved to WiX, uses message queues, but couldn't start up automatically as part of the installation - still not sure exactly why, permissions should have been fine. Starting it manually after installation worked perfectly though. Just a 'tip'.
jamiebarrow
A: 

My suggestion would be to use a Windows Installer project for the Service as it's really easy to configure default username and password. It's also easy to set the default state of the service (autostart, manual start, disabled,...).

For the WPF app I'm actually using ClickOnce over Windows Shares. It's easy to setup and it handles updates automatically.

It would be great to use ClickOnce for the windows service part, but I had no success in doing it.

Carles