TFS msbuild args/p:DeployOnBuild = true似乎什么也没做 [英] TFS msbuild args /p:DeployOnBuild=true doesn't seem to do anything

查看:158
本文介绍了TFS msbuild args/p:DeployOnBuild = true似乎什么也没做的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用TFS和常规的构建过程活动来构建解决方案.但是,我希望能够自动化部署,因此我可以一步一步将其远程构建和部署到服务器.

I'm currently using TFS and the regular build process activity to build a solution. However, I'd like to be able to automate deployment so I can build and deploy remotely to a server in one step.

在MSBuild参数上,我尝试指定部署开关.我的项目是Windows服务,但我知道无论项目类型如何(不是Web项目),仍然可以部署任何二进制文件.

On the MSBuild arguments I am trying to specify the deployment switch. My project is a windows service, but I understand it is still possible to deploy any binaries regardless of the project type (not being a web project).

当前构建参数:

/p:DeployOnBuild=True /p:UserName=user /p:Password=password

当在TFS中运行该构建时,它会成功,但是我希望看到有人尝试将其部署到服务器上,并显示一些有用的错误消息,但未显示任何内容.

When the build runs in TFS it succeeds, however I was expecting to see some attempt at deployment to the server and some helpful error message but nothing shows.

推荐答案

供以后参考,我已经找到为Web服务/项目以外的其他任何东西启用部署的确切条件. DeployOnBuild 参数对Web项目没有任何作用的原因是项目文件需要包含 webapplication.targets PropertyGroup 包含 VSToolsPath 的路径.

For future reference, I've found exactly what is required to enable deployments for anything other than web services/projects. The reason the DeployOnBuild parameter doesn't do anything for anything other than web projects is that the project file needs to include the webapplication.targets and also a PropertyGroup containing the path to the VSToolsPath.

这里的链接为我很好地介绍了Web部署的工作方式以及如何将其集成到我的项目中以部署服务:

This link here gave me a good introduction as to how web deployments work and how to integrate this into my project to deploy services:

http://www.asp.net/web-forms/tutorials/deployment/web-deployment-in-the-enterprise/building-and-packaging-web-application-projects

  1. 要将参数传递到MSBuild中,您需要在项目属性文件夹下的PublishProfiles文件夹内有一个.pubxml文件(称为发布配置文件).

  1. To pass parameters into MSBuild you need a .pubxml file (called the publishing profile) within the PublishProfiles folder under your project properties folder.

我需要.csproj文件中的以下内容:

I needed the following in the .csproj file:

<PropertyGroup>
    <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">11.0</VisualStudioVersion>
    <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
  </PropertyGroup>

  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  <Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v11.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />

  • 如果您需要MSDeploy的pre-sync/post-sync命令,很遗憾,MSBuild无法提供此命令.要实现此功能,您需要在项目根文件夹中有一个X.Wpp.Targets(其中X是您的项目名称).

  • If you need the pre-sync/post-sync commands of MSDeploy, unfortunately this is not available from MSBuild. To do achieve this functionality you need to have a X.Wpp.Targets (where X is your project name) inside your project root folder.

    <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
      <Target Name="UninstallService" BeforeTargets="MSDeployPublish">    
          <!-- Do exec tasks here -->
      </Target>
    
      <Target Name="InstallService" AfterTargets="MSDeployPublish">    
          <!-- Do exec tasks here -->            
      </Target>
    </Project>
    

  • 这篇关于TFS msbuild args/p:DeployOnBuild = true似乎什么也没做的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆