您好我正在使用 MSBuild Extension Pack 将 Windows 服务安装到远程计算机。我正在通过命令提示符对此进行测试,并成功安装了该服务。我现在想使用 MSBuild 参数调用此扩展包。
我的代码如下所示:
<Project ToolsVersion="4.0" DefaultTargets="Default" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<RemoteMachine>DevRemote</RemoteMachine>
<RemoteUser>RemoteDomain\RemoteUser</RemoteUser>
<RemoteUserPassword>RemotePassword</RemoteUserPassword>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\ExtensionPack\4.0\MSBuild.ExtensionPack.tasks"/>
<Target Name="Default">
<MSBuild.ExtensionPack.Computer.WindowsService TaskAction="Install" ServiceName="Backup Management" ServicePath="c:\WINDOWS\system32\taskmgr.exe" RemoteUser="$(RemoteUser)" RemoteUserPassword="$(RemoteUserPassword)" MachineName="$(RemoteMachine)" />
</Target>
我怎样才能做到这一点?根据我的猜测,构建参数看起来像这样:
/p:DeployOnBuild=True /p:DeployWinService=true;TargetWinServiceHost=DevRemote
但我不确定这些论点。任何帮助都非常感谢。