TFS Build Definition And Auto Deploy

一台build machine上一般只有一个build service[对应一个build controller]来serve一个team project
collection,但又workaround来实现多个controller在一台机器上的共存,参考这里

说一说自动化build和自动化部署:

  1.创建Build Definition[build serivce的账号必须有drop folder的写权限,就是Build
Definition\Build Defaults\Staging location下的UNC
path如\\10.1.1.16\DropFolder]。

   注意:a)之前在创建好然后trigger后老是挂掉,原因是版本引用问题,参考这篇mark

      b)在Process中Required->items to build指定要build的solution or project。

  2.在build definition的Process->Advanced->MSBuild
Arguments添加如下参数以完成build后的自动部署(参数之间用空格分开):

    /p:DeployOnBuild=True

    /p:Configuration=Debug  //此处的Configuration可以在configuration
manager中自己创建;每次发布都会做文件的全部替换,不希望web.config文件(此处以web项目为例)被                 //替换的话,其实一般就是数据库的链接字符串和一些appsettings,可以在Web.Debug.Config中做一些设置,详见第三条;

    /p:SkipExtraFilesOnServer=true

    /p:DeployTarget=MSDeployPublish

    /p:MSDeployPublishMethod=RemoteAgent    //即使用web
deploy的方法,如果用其他的比如IIS自带的WMSVC的话,相应参数另行设置;还有WebDeployPackage;

    /p:AllowUntrustedCertificate=True

    /p:CreatePackageOnPublish=true

    /p:DeployIISAppPath=siteName/applicationName

    /p:MsDeployServiceUrl=http://10.1.1.4

    /p:username=domain\tfsbuild2

    /p:password=Abcd1234!

  3.


<?xml version="1.0" encoding="utf-8"?>

<!-- For more information on using web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 -->

<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<!--
In the example below, the "SetAttributes" transform will change the value of
"connectionString" to use "ReleaseSQLServer" only when the "Match" locator
finds an attribute "name" that has a value of "MyDB".

<connectionStrings>
<add name="MyDB" //这里写发布后需要被替换的连接字符串的名字
connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True" //connectionString为自动部署时要被设置的字符串
xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/> //Match是匹配"name"来替换相应的value
</connectionStrings>
-->
<system.web>
<!--
In the example below, the "Replace" transform will replace the entire
<customErrors> section of your web.config file.
Note that because there is only one customErrors section under the
<system.web> node, there is no need to use the "xdt:Locator" attribute.

<customErrors defaultRedirect="GenericError.htm"
mode="RemoteOnly" xdt:Transform="Replace">
<error statusCode="500" redirect="InternalError.htm"/>
</customErrors>
-->
</system.web>
</configuration>

操作中还碰到个问题:同一个site/application路径,一个project可以自动部署,另一个则不行,提问在这儿

总结:做到以上,就可以做自动化build和部署了!PS:如果没有特殊问题比如上边提到的问题。put down this just for
reminding me of how to do some auto-build/deploy related stuff later.

时间: 2024-08-08 05:48:53

TFS Build Definition And Auto Deploy的相关文章

TFS Build做Web应用持续集成发布的一个技巧

由于面向接口编程的关系,许多实现往往是动态注入运行,在一个项目中直接引用实现dll编译是不合理的.通常我们会在Post Build Event中添加一些xcopy命令将运行时才需要的dll复制到输出目录.在发布时会带来一些问题,比如:使用Visual Studio自带的Publish功能发布一个Web应用时就不会运行Post Build Event.同样的在基于TFS Build时也存在类似问题. TFS Build时会根据对应Definition的名称创建两个子目录:Source.Binari

TF42064: The build number already exists for build definition error in TFS2010

In TFS2008, deleting a build removes it from the database itself. If you delete a build called Build_20110423.1 or 1.0.0.1 from Build Explorer and trigger the build again then you will see that new builds starts with same number (Build_20110423.1 or

VMware Auto Deploy仅支持BIOS

使用 VMware Auto Deploy 进行网络引导或置备需要旧版 BIOS 固件,且对于 UEFI不可用.

Auto Deploy在vSphere 6.0中的变化

在 vSphere 6.0 中,Auto Deploy 是与 vCenter Server 一同安装的.要使用 Auto Deploy置备 ESXi 主机,必须安装 vCenter Server 或部署 vCenter Server Appliance.

TFS Build Error: CSC : fatal error CS0042: Unexpected error creating debug information file &#39;xxxx.PDB&#39;

CSC : fatal error CS0042: Unexpected error creating debug information file 'xxxx.PDB' -- 'c:\Builds\xxxx.pdb: The process cannot access the file because it is being used by another process. 查看了详细的Build Log, 发现了同样的一文件被build了两次. 原因是 Solution 中的 Project

TFS Build Silverlight项目的两个问题

1.The Silverlight 4 SDK is not installed. 打开对应的Build Definition,Process -> Advanced -> MSBuild Platform,设置:X86 2.使用Silverlight Toolkit在xaml上出现类似如下错误: The property 'ContextMenu' does not exist on the type 'Grid' in the XML namespace 'clr-namespace:Sy

Vsphere auto deploy 简介

Vsphere auto deploy 介绍 vSphere Auto Deploy   可以为数百台物理主机置备 ESXi 软件.当启动为 Auto Deploy 设置的物理主机时,Auto Deploy 会将 PXE 引导基础架构与 vSphere 主机配置文件结合使用来置备并自定义该主机,主机本身并不存储任何状况,而是由 Auto Deploy 服务器管理每个主机的状况信息. Auto deploy 部署方式 Auto deploy 部署模式有三种,分别为无状态模式,无状态缓存,有状态安装

TFS Build Controller service HTTP code 500: System.ServiceModel.ServiceActivationException

Take a look at Task Manager on the machine where your TFS Repository lives.  We have this problem whenever its memory utilization is greater than 95%. http://stackoverflow.com/questions/20632215/tfs-build-controller-service-http-code-500-system-servi

转 代码修改buildoption

using System;using System.IO;using UnityEditor;using UnityEngine; public class BuildPlayer : ScriptableObject{ static string rootPath = Application.dataPath + Path.DirectorySeparatorChar; static string rootParent = new DirectoryInfo(rootPath).Parent.