使用 TFS 2015 Build 构建和部署 Web 应用程序 [英] Build and Deploy a Web Application with TFS 2015 Build

查看:17
本文介绍了使用 TFS 2015 Build 构建和部署 Web 应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们刚刚在本地安装了 TFS 2015(更新 1),并正在尝试使用新的 TFS 构建系统创建一个持续集成/构建系统.构建工作正常,并给了我一个绿灯,但是当我查看默认构建时,它只从 bin 目录构建了二进制文件,并且似乎没有简单的方法可以将应用程序本地部署到本地服务器.

We have just installed TFS 2015 (Update 1) on-premise and are trying to create a Continuous Integration/Build system using the new TFS Build system. The build works fine, and gives me a green light, but when I look at the default build it has only built the binaries from the bin directory, and there seems to be no easy way to deploy the app on-premise to a local server.

文件系统副本有两个部署选项和一个 powershell 脚本,使用它们将文件复制到新服务器当然很容易,但是由于构建只构建了二进制文件,我看不到为此收集 Web 工件(cshtml、图像、脚本、css 等)的工具.

There are two deploy options for a filesystem copy, and a powershell script, and it would certainly be easy enough to use them to copy files to a new server, but since the build only built the binaries, I don't see a tool to gather up the Web artifacts (cshtml, images, scripts, css, etc..) for this.

经过详尽的谷歌搜索,我只找到了一篇关于这个的文章:

After an exhaustive google search, I've only found one article which talks about this at:

http://www.deliveron.com/blog/building-websites-team-foundation-build-2015/

然而,这使用了 WebDeploy 并创建了一个相当混乱的部署包.

However, this uses WebDeploy and creates a rather messy deploy package.

如何以最简单的方式将站点(标准 MVC Web 应用程序,实际上我的测试使用由创建项目向导创建的默认样板站点)连同工件部署到本地服务器?我不想在服务器上安装 WebDeploy,而是更愿意使用 PowerShell 或其他东西来部署最终的工件.

How can I deploy the site (standard MVC web application, in fact my tests are using the default boilerplate site created by the create project wizard) complete with artifacts to a local server in the easiest possible way? I don't want to have to install WebDeploy on the servers, and would rather use PowerShell or something to deploy the final artifacts.

构建只是标准的 Visual Studio 构建模板,包含 4 个步骤(构建、测试、索引和发布、发布构建工件).

The build is just the standard Visual Studio build template, with 4 steps (Build, Test, Index & Publish, Publish Build Artifacts).

推荐答案

我们使用Visual Studio Build"步骤,作为 MSBuild 的参数,我们使用以下行:

We use "Visual Studio Build" step and as Arguments for MSBuild we use following line:

/p:DeployOnBuild=True /p:PublishProfile=$(DeploymentConfiguration)

在变量标签页上必须配置 DeploymentConfiguration.它必须是发布配置文件的名称(pubxml 文件的文件名).如果文件名为 Build.pubxml,则发布配置文件为 Build.

On Variables tab page DeploymentConfiguration has to be configured. It must be the Name of the publish Profile (filename of the pubxml file). If the file Name is Build.pubxml the publish profile is Build.

例如:

/p:DeployOnBuild=True /p:PublishProfile=Build

这篇关于使用 TFS 2015 Build 构建和部署 Web 应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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