本文介绍了如何使用VSTS来构建Web应用程序并将其发布到FTP服务器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过VSTS,我正在尝试自动执行以下当前手动执行的过程:

Via VSTS I am trying to automate the following process which is currently performed manually:

  1. 在VS 2017中执行发布到文件系统.
  2. 在web.config中设置设置.
  3. 重复1和2,对于每种环境,例如测试,UAT,生产等
  4. 将这些文件复制到FTP服务器.
  5. 登录到安全的基础结构,从FTP下载文件,然后将其复制到IIS目标服务器上.

安全基础结构已被锁定,并且互联网访问受到限制. FTP被用作将文件移入该基础结构的一种方式.

The secure infrastructure is locked down, and has limited internet access. The FTP is used as a way to move files into that infrastructure.

在这个问题中,我特别想讨论元素; 1、2和3.

Within this question I specifically want to address elements; 1, 2, and 3.

我遇到的困难是,VSTS似乎已设置为将Web应用程序部署到Azure网站或可公开访问的IIS中.虽然IIS是我的最终目标,但最初我希望实现文件系统部署-与VS 2017相似.

The struggle I am having is that VSTS seems setup to deploy web apps into Azure Web Sites or publicly accessible IIS. Whilst IIS is my eventual target, initially I was hoping to achieve a file system deployment - similar to what VS 2017 provides.

我曾尝试使用MSBuild创建一个程序包,方法是: /p:WebPublishMethod=Package /p:PackageAsSingleFile=true.

I have tried using MSBuild to create a package, using; /p:WebPublishMethod=Package /p:PackageAsSingleFile=true.

然后MSDeploy将软件包解压缩到文件夹msdeploy.exe -verb:sync -source:package="Package.zip" -dest:contentPath="content"中.

Then MSDeploy to extract the package into a folder msdeploy.exe -verb:sync -source:package="Package.zip" -dest:contentPath="content".

但是会导致以下错误Source (sitemanifest) and destination (contentPath) are not compatible for the given operation.

看起来我可以在构建时使用MSBuild和/p:DeployOnBuild=true /p:PublishProfile=VSTS部署到文件夹,但这在VSTS的结构中似乎有点尴尬.例如.我必须针对每种环境重复构建解决方案.

It looks like I can use MSBuild and /p:DeployOnBuild=true /p:PublishProfile=VSTS to deploy to a folder at build time, but that seems a little awkward within the structure of VSTS. E.g. I have to repeatedly build the solution for each environment.

将解决方案部署到文件夹后,我打算使用VSTS推送到FTP.

After I have the solution deployed into a folder, I intend to use VSTS to push to FTP.

是否有更好的方法可以做到这一点?例如; VSTS Azure部署提供了轻松设置连接字符串参数的功能.

Is there a better way to do this? For example; VSTS Azure deploy provides the ability to easily set connection sting parameters.

推荐答案

您可以使用FTP上传构建/发布任务来实现自己的目标.

You can achieve what you want to do with the FTP Upload build/release task.

1-您不必发布到文件系统.只需基于asp.net应用程序模板创建一个新的构建定义:

1 - You don't have to publish to the file system.Just create a new build definition based on asp.net application template:

这将添加您需要构建和打包的任务,并作为将工件发布到放置位置的最后一步.

This will add the tasks you need to build and package and as a final step to publish the artifacts to a drop location.

将其发布到放置位置后,可以通过添加ftp任务继续进行构建,也可以将ftp任务添加至发布管道.这取决于您.

After you published it to a drop location you can either continue on build by adding the ftp task or you could add the ftp task to a release pipeline. This is up to you.

然后需要在发布工件任务之后添加ftp上传任务,例如:

The ftp upload task then needs to be added after the publish artifacts task, like:

对于2和3,最好使用发布管道,您可以在其中添加多个环境和任务.您可以添加ftp任务,并从要添加到版本中的构件(您的构建)中获取它.也可以使用发布任务来更改web.config设置.

For 2 and 3 it is best that you use a release pipeline, where you can add several environments and tasks to it. That you can add your ftp task and get it from artifact (your build) that you will add to the release. The web.config settings can also be changed using release tasks.

这篇关于如何使用VSTS来构建Web应用程序并将其发布到FTP服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 15:54