1
嗨,我正在使用MSBuild扩展包来安装Windows服务到远程机器。我通过命令提示符测试了它,并成功安装了该服务。我现在想用MSBuild参数来调用这个扩展包。如何通过MSBuild参数调用MSBuild.ExtensionPack?
我的代码如下所示:
<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
但我不确定的论点。任何帮助真的很感激。