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

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

问题描述

在我的解决方案中,我有两个项目(Asp.net MVC和Windows Service).我想创建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.

例如,假设您有作为单个项目的当前工件,包括_PublishedWebsites \ MVS5WebApp(可部署XCopy的网站)和_PublishedWebsites \ MVS5WebApp_Package(网络部署包).

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

如果要将这两部分分成两个工件,则可以使用两个Publish Artifact任务,如下所示,每个任务都指定要发布的确切路径(该路径不支持通配符,您只需要指定所需的文件夹即可发布)

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天全站免登陆