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

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

问题描述

我们刚刚在内部安装了TFS 2015(更新1),并正在尝试使用新的TFS Build系统创建持续集成/构建系统.该构建工作正常,并为我开了绿灯,但是当我查看默认构建时,它仅从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.

经过详尽的Google搜索后,我仅在以下位置找到一篇有关此内容的文章:

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构建"步骤,作为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天全站免登陆