如何使用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.



 1 条回答