使用MSBuild和Microsoft.Sdc.Tasks安装Win32服务 [英] Installing a win32 service using MSBuild and Microsoft.Sdc.Tasks
问题描述
我正在尝试使用Microsoft.Sdc.Tasks库安装Windows服务.
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?
推荐答案
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.
我通过炮轰InstallUtil.exe来解决.在将我将服务安装程序"设置为以本地服务帐户身份运行后,效果很好.
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" />
这篇关于使用MSBuild和Microsoft.Sdc.Tasks安装Win32服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!