How to publish artifacts separately for each project in solution from VSTS CI pipeline?

感情迁移 提交于 2020-05-09 21:39:28

问题


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: 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.


回答1:


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

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).

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.




回答2:


If you are using '.net core' task in the build pipeline then uncheck the checkbox 'Publish web projects' just after the command textbox.

Then it automatically creates publish artifacts separate for each project in the solution with the same name as each of the project files.




回答3:


You have multiple ways to achieve that.
You can either create multiple build definitions targeting the project and not the solution in the build step with the proper arguments.
Or you can have one build definition with multiple build steps.
After that on the release side of things you can either leverage one release definition with multiple steps or multiple release definitions.



来源:https://stackoverflow.com/questions/47841362/how-to-publish-artifacts-separately-for-each-project-in-solution-from-vsts-ci-pi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!