Manage related project deployment in Continuous Deployment - visual-studio

I am planning of using Visual Studio TFS server for Continuous Deployment.
I have few projects which are related and when a particular project is updated it might rigger a change in that related project
E.g. Web Project and a Middle Layer API project
Now when I follow CD , how can I ensure that Middle layer API project is deployed before the Web Project is deployed

You have to create only one release to deploy your two related projects.
Choose one of them as the main artifact. Let's say the web project.
At the artifacts page in the release configuration, add your middle layer project as another artifact to the release.
Now that you have your two target projects, setup your release pipeline so that you add the steps to deploy your layer project before your web project.

Related

How can I branch a solution with multiple projects referenced in VS.Net using TFS Version Control

I have one main Web project that references multiple projects.
These projects are shared with other solutions.
Each project has its own workspace area in Azure Devops (VS Online)
I'm using Team Foundation Version Control (TFVC, not Git)
When I need to create a branch of this Web project, I manually:
Create a branch of this Web project
For each referenced project I create a branch
Open the Web project branch newly created and adjust its references to the branched projects
It takes I lot of time!
How can I branch this Web project and all its referenced projects (considering that each one has its own workspace area) in a practical way?

Clarification on correct usage of TFS to publish Web Application

I'm trying to setup CI via TFS 2015, I've got a solution that has got 2 main Web application that currently we deploy manually editing the config files and so on (which sometimes leads to errors)
I've read about build/release process and in the past I've used Jenkins as build server. But till today I've got a question and that's related to when apply the transformation of XML config files.
In my current VTFS2015 setup I've created a build process and I build the project with the following line
msbuild /p:Configuration=Test /p:PublishProfile=Test /p:DeployOnBuild=true xxx\xxx.csproj
This creates me in the folder obj\Test\Package\PackageTmp the package
Is this ok? or should this be done in the release management tab? Consider in my farm I've
Test (from DEV trunk)
Staging (from Dev trunk as well)
Production (from production trunk on 3 machines)
My goal is to have them automatically delivered on the machines, but I don't know the right moment to apply the transformation (during the build I can use the publish feature, during the RM I can use a ps1 script)
Thanks in advance
Well, I think this thread will helps: What TFS 2017 build task applies web.config transforms during TFS builds?
To apply the transformations you can use the extension: Apply transformations in vNext build process.
Usually it should be a package and be used in a deploy task such as
Deploy: WinRM - IIS Web App Deployment or Azure App Service
Deployment to achieved the deployment.
1) Can transforms be engaged in both Builds and Releases?
Yes, you could also do this in a build pipeline with the useage of build deploy task. You need to add the task after the publish build
artifacts task.
2) Does TFS 2017 require a lot of special handling to engage a
transform file?
update
The BuildConfiguration variable is different in TFS 2017, it's inside
the MSBuild task! Transforms are now applied according
to the MSBuild task Configuration setting.
Edit the .proj file is a method to do the transform. If you don't need to change the transform, it will auto do it during the build.You
could also use some 3-rd party task/extension for extra transform such
as: XDT Transform
Usually we separate the build and release for the deployment, cause
it's easy to configure multiple environments and easy to debug issue.
You definitely could do this only in build but with a bloated process.
You could refer this tutorial: Build and Deploy Azure Web Apps using
Team Foundation Server/Services vNext Builds.
For a separate build and release solution, you could take a look at
this blog: Using web.config transforms and Release Manager – TFS
2017/Team Services edition

VSTS Build Definitions for Solutions with multiple web projects

I have visual studio solution with 2 web projects. The source is in VSTS and the apps are hosted in Azure. I have build and release management setup to automatically deploy to Azure.
So every time I check in something, 2 releases are triggered, one for each web project. Is there any way I can separate the two? The web project should only trigger for a check in on that folder and the api trigger for a check in on that folder?
You just need to change Path filters for specific path of each web project path. More information, you can refer to Build definition triggers.

CI Deploy of Azure Functions project in solution containing a web project

We have a solution that contains (among other things) an Azure Functions project, a Web application project and a WCF project. The solution is hosted in VSTS as a Git repository.
I have used the "Configure continuous integration" button in the Azure portal > Function app settings to select the repository, but when the build is triggered and deployed, according to the logs generated it's trying to deploy the Web app rather than the Functions.
How can I configure a CI build to deploy the Azure Functions project from that solution?
You should be able to customize your deployment and set the target project as documented here.
More specifically, you want to use the project configuration to point to your azure functions project/folder (using a deployment file, or config setting)

Build not publishing Web API project in Visual Studio Team Services (was VS Online)

I have created a VS build definition on Team Services. The build runs successfully when I queue it and it also outputs the dlls for all the projects in the solution except the service layer which I have created using Web Api2.
when I download the artifacts from the drop location, I have folders holding the dlls for the data layer, the business layer and other helper projects. What I don't have is the main service layer dll which I can deploy to my IIS.
Here is a screenshot of my publish settings.
What could I be missing ?
It seems that you are using the default settings for the build definition. With these settings, the contents for "Copy Files" task is "**\bin\$(BuildConfiguration)**" while web api project does not have buildconfiguration folder. So it cannot find the files for web api project. To copy these files, add one more "Copy Files" task and configure the settings as following:
If you want the deployment files for the project, you need to set you build definition as following:
Add arguments /p:DeployOnBuild=true;OutDir="$(build.artifactstagingdirectory)" for Visual Studio Build step.
Remove Copy Files step.
Set Path to Publish to $(build.artifactstagingdirectory)\\_PublishedWebsites for Publish Build Artifacts step.
Then you should get the deployment files in the drop folder.
Open the Configuration Manager in VisualStudio and ensure the WebAPI project is included for the configuration (Debug, Release, etc) that you are building.

Resources