如何从 VSTS CI 管道为解决方案中的每个项目分别发布工件? [英] How to publish artifacts separately for each project in solution from VSTS CI pipeline?

本文介绍了如何从 VSTS CI 管道为解决方案中的每个项目分别发布工件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的解决方案中,我有两个项目(一个 Asp.net MVC 和一个 Windows 服务).我想创建 CI/CD 管道以在不同的 VM 上部署 Web 应用程序和 Windows 服务.但是为了实现这一点,我的 CI 管道应该能够分别为两个项目发布工件,然后我可以在 CD 管道中提供这些工件以进行部署.如何在 CI 管道中单独发布所有项目的工件?

In my solution, I have two projects (a Asp.net MVC and a Windows Service). I want to create CI/CD pipeline to deploy web application and windows service on different VMs. But to achieve this my CI pipeline should be able to publish artifacts separately for both project and then I can feed these artifacts in CD pipeline for deployment. How artifacts for all projects can be published separately in a CI pipeline ?

PS:如果我创建两个解决方案,每个解决方案只包含一个项目,并分别创建 CI/CD 管道,则一切正常.但我想用上面提到的具有多个项目的解决方案来实现它.

PS: If I create two solutions each with one project only and create CI/CD pipeline separately, all works fine. But I want to achieve it with solution having multiple project as mentioned above.

推荐答案

您可以使用多个发布任务在单个构建定义中创建多个工件.

You can use multiple, Publish tasks to create multiple artifacts in a single build definition.

例如,假设您有以下作为单个项目的当前工件,包括 _PublishedWebsitesMVS5WebApp(XCopy 可部署网站)和 _PublishedWebsitesMVS5WebApp_Package(网络部署包).

For example lets say, you have below, as your current artifacts for a single project, comprising of _PublishedWebsitesMVS5WebApp (XCopy deployable website) and _PublishedWebsitesMVS5WebApp_Package (web deploy package).

如果你想把这两者分开,分成两个工件,你可以使用如下所示的两个发布工件任务,每个任务指定发布的确切路径(此路径不支持通配符,你只需要指定你需要的文件夹发表)

If you want to separate these two, into two artifacts, you can use two Publish Artifact tasks as shown below, each one specifying exact path to publish (this path does not support wildcards, you just have to specify the folder you need to publish)

这将为您提供如下所示的输出.

This will give you output as shown below.

在此示例中,我仅使用了发布工件任务并使用单个网站项目创建了两个工件.您可以为您的两个项目场景做同样的事情.如果您想在发布前使用通配符过滤更多文件,您可以根据需要多次使用复制文件"任务.

In this example I just only used the Publish Artifacts task and created two artifacts using a single web site project. You can do same for your two project scenario. If you want to use wild card to filter more files before publish you can use "Copy File" task multiple times as required.

这篇关于如何从 VSTS CI 管道为解决方案中的每个项目分别发布工件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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