如何在自动 TFS2017 构建中调用发布配置文件? [英] How do I invoke a publish profile in an automated TFS2017 build?

查看:27
本文介绍了如何在自动 TFS2017 构建中调用发布配置文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已成功升级到 VS/TFS 2017,现在我希望构建使用项目的发布配置文件之一自动将网站发布到暂存位置.TFS 团队项目站点的构建和发布"部分的灵活性给我留下了深刻的印象,但它有点让人不知所措.

I have successfully upgraded to VS/TFS 2017, and I am at the point where I want the build to automatically publish a website to a staging location using one of the project's publish profiles. I am impressed with the flexibility in the "Build & Release" section of the TFS Team Project Site, but it's a little overwhelming.

该项目有 2 个简单的发布配置文件.两者都使用FTP 发布方法"上传到 Go Daddy 托管服务提供商;一个在上传前删除所有文件,另一个只更新文件.有转换应用于连接字符串之类的东西.这些发布配置文件正常工作.我只需要在自动构建结束时添加它们.

This project has 2 simple publish profiles. Both use the 'FTP publish method' to upload to the Go Daddy hosting provider; one deletes all files before upload, the other only updates files. There are transforms applied for things like connection strings. These publish profiles work properly. I just need them to be added at the end of an automated build.

似乎说使用此发布配置文件"应该很简单,但是有太多的选项和选择,使用哪个从直观上看并不明显,而且我无法在网上找到参考专注于我想做的事情.

It would seem it should be simple to say 'use this publish profile', but there are so many options and choices it's not intuitively obvious which to use, and I haven't been able to find a reference on the web that focuses on what I want to do.

推荐答案

如果您想使用发布配置文件调用 msbuild 命令将网站发布到 FTP 位置,那么这是不可能的,因为命令行不支持 FTP 发布.

If you want to invoke the msbuild command using the publish profile to publish website to FTP location, then it's impossible as FTP publishing is not supported on the command line.

如果您坚持调用发布配置文件,那么您可以使用用于将网站发布到暂存位置(例如,本地或 UNC 路径)的发布配置文件调用 msbuild 命令行,然后使用 FTP 上传 将网站从暂存位置上传到特定 FTP 位置的任务步骤,或使用 PowerShell 脚本上传网站.

If you insist on invoking the publish profile, then you can invoke msbuild command line with the publish profile used to publish the website to a staging location (eg, local or UNC path), then use FTP upload task step to upload the website from the staging location to the specific FTP location, or using PowerShell script to upload the website.

您可以参考此线程:如何添加FTP网站部署到 VS2015/TFS2013 构建过程

这篇关于如何在自动 TFS2017 构建中调用发布配置文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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