views:

870

answers:

2

I'm trying to install windows service using the Microsoft.Sdc.Tasks library.

<ControlService Action="Install"
    ServiceName="Service1"
    User="XXX
    Password="XXX"
    ServiceExePath="$(DeployFolder)\XXX.exe"/>

But I keep getting prompted for the user and password! This will not work as I'd like to have it as an automated build on the build server. I mean, the user and password that I want to run the service under are in the actual target. How do I get it to install the service using the configured user and password and not prompt for it?

+3  A: 

Found this post and since all my service does is writing and reading from local file I should be OK running under the Local Service account instead of a specific user. Even after updated the service installer the ControlService-target requires a user and password to run but then I actually doesn't prompt me for the user and password. But then I don't want to run a specific user and the target fails when not provided with a user and password in the config ... Strange.

I solved by shelling out to the InstallUtil.exe instead. That works fine after set the I set service installer to run as a Local Service account.

<Exec WorkingDirectory="C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727"
      Command="InstallUtil.exe -i XXX.exe" />
Riri
This will only install the service on the build server. If you want to install it to a remote server, you should use the servicecontroller task from here: http://weblogs.asp.net/scottgu/archive/2006/02/12/438061.aspx
Peter Walke
A: 

Just an FYI, to install to a remote server, you should use the SericeController task listed here:

http://weblogs.asp.net/scottgu/archive/2006/02/12/438061.aspx

Peter Walke
The ServiceController task doesn't allow services to be installed. It just controls installed services.
MikeD