Script creation of Builds and Releases in TFS 2015 - continuous-integration

I recently finished figuring out a Build and Release process for our environment using TFS 2015 vNext build and release tasks. I'll now need to duplicate that several dozen projects. I've been looking around and I see no way to automate or script this process. Is it possible to script the creation of builds and releases or create them from a pre-populated template?

Not any official solution and task could do this for now. There has been a feature request in user voice and with STARTED status, you can vote up and monitor it
VSO build vnext: share build templates between projects
https://visualstudio.uservoice.com/forums/330519-team-services/suggestions/8468566-vso-build-vnext-share-build-templates-between-pro
As a workaround, you could use an Export/Import Build Definition extension in Visual Studio Marketplace. However, it's only work with build definition.For release definition, give a try with this one Clone release definition (for TFS 2015 U2 and above).

Related

How can I consistently automate, using TFS vNext build steps, building whatever solution files our development teams get working using Visual Studio?

Developers use the Visual Studio (VS) GUI to develop their solutions and get their projects all building using a solution file (.SLN). The build teams using vNext then have to automate those builds using MSBuild instead of devenv.exe (the Visual Studio executable file). This is a serious and chronic problem because not only is MSBuild incapable of building several project types, but the build order is defined in a completely different, and complex, way.
Some Microsoft advice (https://learn.microsoft.com/en-us/archive/blogs/msbuild/incorrect-solution-build-ordering-when-using-msbuild-exe) is to switch to explicit dependencies in each .*proj file and remove all dependency specifications in the .SLN file. This sounds like a person who has never worked in a relatively powerless build team trying to get development teams to:
do a lot of what they perceive as time-wasting extra work and to
change how they do things
What build teams need is a way to automate whatever VS allows dev teams to build. If VS is given a SLN to build, then a vNext build needs to be able to use that same SLN in the same way. Instead vNext currently only offers MSBuild as the build tool. MSBuild has many more options than devenv, so that would be great, IF it could be made to use the SLN to govern dependencies in the same way as VS, and would be upgraded to build all the same project types.
There have been prospective efforts, referenced by PatrickLu-MSFT at Build project using devenv.exe in TFS 15RC1 Build Server, to enhance a vNext build step to allow devenv to be used instead of MSBuild, but those efforts seem to have been dropped.
Maybe someone has developed a custom vNext build step to build using devenv?
Here is an existing extension you can reference, which provides a build task in your TFS/VSTS instance that will allow you to build your projects using DevEnv.com (Visual Studio):
https://marketplace.visualstudio.com/items?itemName=mmajcica.devenv-build
If you want to automatically use TFS/DevOps build whatever solution files our development teams get working using Visual Studio, you could set CI trigger in build pipeline, when the solution build successfully on local, you can check in/commit the changes, and trigger TFS/DevOps builds.

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

How to Automate Build and Deployment in Visual Studio TFS?

I am looking to automate Build and Deployment in Visual Studio T.F.S and going through this link for the same.
https://marketplace.visualstudio.com/items?itemName=ms-vsts.ibm-websphere
It clearly says to install IBM Websphere Extension but i am not sure from where can i get it done?
If you are using the the old Xaml build system (TFS 2013 and earlier version), you can follow the steps mentioned in below link to build and deploy the project:
Automated Web Deployment and Team Build Using TFS 2013
If you are using vNext build (TFS 2015 and later version), you can use the CI/CD. Please see Continuous integration, test, and deployment tutorial and CI/CD Hello world for details.
You do not need websphere in order to automate builds, builds are created by a build server and placed in an output ( drop folder location ).
Deployment can be handed by creating post build scripts, there are a number of solutions for handling larger deployments but start with the basic build deployment workflow and scale from there.
See the following QuickStart to get an idea of build/deployment process.
https://learn.microsoft.com/en-us/vsts/build-release/actions/ci-cd-part-1#create-a-release-definition

TFS 2015 continues build only output changed assemblies

I have a solution in TFS 2015 that using continues integration build method, what i want is every check-in triggers a build that selectively only output changed dlls, exe, into the artifact folder. Is there a such configuration to do so?
Unfortunately, there is no this built-in configuration with vNext build in TFS2015.
However, a obvious solution is adding a Powershell Script on what to publish as artifacts. Using a PowerShell script to organize everything and pre-compressing in single files is the best approach for your situation.
Detail step and screenshot please take a look at this blog: Manage Artifacts with TFS Build vNext

How to execute one TFS 2010 build script from other TFS 2010 build script

I am having two separate build script written in TFS 2010. One is for application and other is for wcf service. I need to execute service build script from application's build scripts. Could someone please suggest how could I achieve this. Thanks.
To simply trigger one build after finishing another, you can use the tfsbuild utility that is installed on a system when you install Team Explorer.
You should be able to call it using
<Exec Command="$(VS140COMNTOOLS)\..\IDE\tfsbuild.exe start $(TeaFoundationServerUrl) $(TeamProject) DefinitionName" />
check the additional parameters here in the docs.
A list of useful environment variables available can be found here: http://www.woodwardweb.com/vsts/30_useful_team.html
Do note that the .proj files to orchestarte your builds are ancient (from the 2008 era) and have long since been outdated first by XAML builds and later by the new 2015 Build engine.
Team Foundation Server 2010 itself is no longer supported by Microsoft since June last year.

Resources