I have a CI pipeline(VSTS) in which I am able to build whole solution which has two website projects in it in a single artifact. What I want to do it build whole solution and then create publish artifact for each project. e.g. One artifact for Project_website1 One artifact for Project_website2 thanks. I tried similar topic in StackOverflow but didnt work for me
问题:
回答1:
You can use two publish artifacts tasks and may be copy files multiple tasks to achieve any number of artifact in VSTS build. For example, say you have 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).
Result would be two artifacts
You can get more idea from the post here. Also this post might be useful for you to understand more possibilities.
回答2:
To publish the two websites projects’ artifacts separately, you just need to use two VS build tasks and two Publish Build Artifacts tasks to build and publish the two websites separately.
Such as the first VS build task and Publish Build Artifacts task are for website1, and the second VS build task and Publish Build Artifacts task are for website2. The detail configurations for each task as below:
VS build task for website1 (store the package for website1 in
$(build.artifactstagingdirectory)\web1
):Publish Build Artifacts for website1 (publish website1’s artifacts from
$(build.artifactstagingdirectory)\web1
to artifactweb1
):VS build for website2 (store the package for website2 in
$(build.artifactstagingdirectory)\web2
):Publish Build Artifacts for website2 (publish website2’s artifacts from
$(build.artifactstagingdirectory)\web2
toweb2
):
Then you can get build artifacts for the two projects separately:
回答3:
This is what I have done As I am using my own agent So the web projects are published in agent’s each project published directory. That is directory a.
Solution: All i did was after builidng the whole solution once vsts put all website in publish directory a. I wrote powershell script to get each file for project and put it under subdirectory in published folder a.
E.g Publish folder a will look like this after building solution Website1.......xml Website1.......zip . . . Website2........xml Website2........zip . . .
Etc When solution is build the files will be in above folder togeter.
In order to build artifact for each project i wrote powershell script to put each project file in sub directory E.g a\website1 Website1.......xml Website1.......zip
a\website2 Website2.......xml Website2.......zip
Etc and so on
After that select each publish artifact for each directory and you can have artifact for each project. Thanks