Publish multiple projects - AzureDevOps - azure-devops

Sure this will be an easy one - but when creating a pipeline for a solution that includes 2 projects, one with and without wwwroot only the web project gets published. How do we publish all projects?

Normally we have at least two directions:
Create multiple pipelines (two CI pipelines or two CI and two CD pipelines), one for ProjectA and the other for ProjectB.
Create one pipeline with multiple publish steps. So you may have two Publish tasks in same pipeline, one to publish ProjectA and the other to publish ProjectB.
But since it's unclear the project type of your projects, and which task do you use the 'Publish', you may get help help from these tips:
If the publish you mean is Publish Artifact, check this issue.
If the Publish you mean is to deploy the projects to something like Azure App Service, also you're using the Azure App Service Deploy task:
You can copy the ProjectA and ProjectB's outputs to same path, and set the value of PackageOrFolder to that path. (If the two projects have dependency relationship, so you may need to publish two projects together to same path?)
Or just use two Publish tasks. Use the Publish task you used to use for publishing the web project. To publish the non-web project, you may need a different publish task? (Not sure about the project type and what place you want to publish to, I'm not sure about the task you should use).

Related

Azure Pipeline artifacts do not show under Storage

I have created a c++ pipeline where the output of the build pipeline is published to drop container. The structure is the following
drop/v1.0.0/Release/MyService.dll
drop/v1.1.0/Release/MyService.dll
drop/v1.1.0/Release/MyService.dll
My engineers will need to view drop folder and according to the version that needs to be manually deployed to a client the will download the dll file.
As far as I understand there is not any way to view them under Artifacts (what a shame). I go to the project settings under Storage but I cannot view them either there. Only place that I am able to find them is under the pipeline run and then I have to find in which version of the pipeline run a specific service version was produced. This is a maze. We have dozens of c++ projects and we have to keep track of which pipeline version run of each project matches the service version.
Is there any way to be able to access them like in a folder structure?
You could use Builds - List via rest API to get all the builds for a pipeline, then use : Artifacts - List rest API to get all the artifacts for a build. It will list all the download URL for artifacts, then you could download them together or choose the one you want to download.
Besides, you could use the publishLocation argument in publish build artifacts task to copy the artifacts to a file share (FilePath). And the file share must be accessible from the agent running the pipeline. In this way you could publish all your artifacts to the file share you want for better management.
In addition, you could also use Universal Package task to publish your artifacts to your feed for better review.

confusion on Azure DevOps pipelines

I've recently been working on switching from On premise TFS to Azure DevOps, and trying to learn more about the different pipelines and I think I may have had my Build pipeline do too much.
Currently I have my Build Pipeline do
Get Source code from Repo
Run database scripts/deploy dacpacs
Copy files over to virtual machines that have web application set up already
Run unit/integration tests
Publish the test results
I repeat these steps closely multiple times, one for develop branch, one for current and previous release branch.
But if I want to take advantage of the Releases and Deployments areas what would that really get me?
It looks like it would be easier to say yes this code did make it out to this dev/beta environment.
I'm working with ColdFusion code that includes some .NET webservices within the repo, would I have to make an artifact that zips up the repo and then deploys it, or is there a better way to take advantage of the release pipeline?
It's not necessary to make an artifact that zips up the repo and then deploys it. There are several types of tools you might use in your application lifecycle process to produce or store artifacts. For example, you might use version control systems such as Git or TFVC to store your artifacts. You can configure Azure Pipelines to deploy artifacts from multiple sources. Check the following link for more details:
https://learn.microsoft.com/en-us/azure/devops/pipelines/release/artifacts?view=azure-devops#sources

Setting up build and deployment for a solution which have three web projects that needs to be deployed with Azure DevOps

I have a solution in VS where I have multiple projects but three of them need to be deployed in different azure web applications.
I have read tutorials where all of them show you these simple steps:
Setting up a build (pointing a .sln file)
Getting an artifact in a .zip file
Setting up a release pipeline where you select the artifacts (.zip file) and select the azure web application you want to deploy the artifact.
All that is fairly simple and works well when you have one web application in your solution. In my case it doesn't work because I think the artifacts have multiple application and I'm not giving any information to the deployment pipeline how it will select only one application from the zip file for each Azure Web Application.
How is the better way to approach it?
You have to change your way of build. Instead of building the solution (.sln) you can use (.csproj) (assuming you have a common .sln file which is having multiple .csporj)
Steps:
Setting up the build - pointing projectA.csproj
Setting up the build - pointing projectB.csproj
Setting up the build - pointing projectC.csproj
Getting all the artifact in a separate zip ( 3 zip)
During the release you can deploy the corresponding artifact (zip) to your azure web apps
Lets say if you have a common .sln which is having a 3 separate .sln solutions. you can follow my answer here

CI_VSTS publish different web Artifact for each project in single solution

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
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.
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 artifact web1):
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 to web2):
Then you can get build artifacts for the two projects separately:
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

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

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