简体   繁体   English

在Visual Studio Team Services / Azure DevOps中通过FTP在单个解决方案中部署多个站点

[英]Deploying Multiple Sites in Single Solution by FTP in Visual Studio Team Services / Azure DevOps

I have a Visual Studio solution which has various class libraries and several ASP.NET website projects. 我有一个Visual Studio解决方案,其中包含各种类库和几个ASP.NET网站项目。 The website projects reference the class library projects, so for ease of working they need to be in the same solution. 该网站项目引用了类库项目,因此为了便于工作,它们需要处于同一解决方案中。

The whole solution is version controlled through Visual Studio Team Services (now Azure DevOps). 整个解决方案通过Visual Studio Team Services(现在称为Azure DevOps)进行版本控制。

When the solution is committed to VSTS, the solution is automatically built by VSTS. 将解决方案提交给VSTS后,该解决方案将由VSTS自动构建。

I also want to use continuous integration and deploy the website projects in the solution to various web servers via FTP (FTP is the only option for this, MSDeploy etc is not available). 我还想使用持续集成,并将解决方案中的网站项目通过FTP部署到各种Web服务器(FTP是唯一的选择,MSDeploy等不可用)。 The releases will be triggered by the build on commit. 这些发布将由提交时的构建触发。

The problem is that I need to publish the actual website files via FTP during a release triggered by the build, but the build artifact only contains .zip files. 问题是,在由构建触发的发行版中,我需要通过FTP发布实际的网站文件,但是构建工件仅包含.zip文件。

For example, if the solution has a website project called 'MyWebsite' the build artifact has a zip called Mywebsite.zip, but no files are accessible. 例如,如果解决方案具有一个名为“ MyWebsite”的网站项目,则构建工件具有一个名为Mywebsite.zip的zip,但是无法访问任何文件。 As such, I can deploy a zip file to the web server, but not the actual website files. 这样,我可以将zip文件部署到Web服务器,而不是实际的网站文件。

How can I deploy these files? 如何部署这些文件?

Furthermore, I don't want to deploy all of the files in the website project. 此外,我不想在网站项目中部署所有文件。 I want to deploy a release version (similar to what is published using Visual Studio 2017's Publish tool), which the zip file seems to contain. 我想部署一个发布版本(类似于使用Visual Studio 2017的发布工具发布的版本),该zip文件似乎包含该版本。

VSTS/Azure Dev Ops has Tasks built in to Extract Files and FTP Upload . VSTS / Azure Dev Ops具有内置的任务以提取文件FTP上传 The release pipeline also has a variables which you can access via release tasks and powershell. 发布管道还具有一个变量,您可以通过发布任务和powershell对其进行访问。 $(System.DefaultWorkingDirectory) is where artifacts(built code) are downloaded to. $(System.DefaultWorkingDirectory)是将构件(内置代码)下载到的位置。 An Agent Job with two tasks should be able to accomplish what you are looking for. 具有两个任务的代理工作应该能够完成您想要的工作。

Tasks 任务 任务 Details 细节 提取文件详细信息 在此处输入图片说明

Azure Dev Ops Release Variables Azure Dev Ops发布变量

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM