I'm using TFS SDK and I wrote some code which is getting latest version of the selected project from the server. Now that I have the code downloaded I would like to invoke a build of the source locally.
Could you give me tutorial or example code on how to do this with MSBuild?
You can use TFS Team Build Template to do all the activities
Get Latest
Compile Code
Do other activities like running Unit Test, Code Coverage etc..
You can also write custom build activities.
Hope this helps to start
Related
Actually, I was working with manual build and release concept and Now I have to start the automation with TFS2013, so Please suggest how to start the Build automation with TFS2013, I am getting confused while the merging from a development branch to QA branch.
XAML builds are deprecated. We strongly recommend that you upgrade TFS2013 and migrate to the new build system as explained in this official tutorial.
However, if you have to use TFS2013, then to enable XAML builds you must connect a XAML build controller to your collection. See Configure and manage your build system.
You could also customize your XAML templates or added custom tasks as your requirement.
If you want a step by step build/deploy process and tutorial, I would suggest you take a look at this wonderful blog-- Automated Web Deployment and Team Build Using TFS 2013
In vNext (TFS 2017.3 on prem) I have a build definition which builds a .NET application and run around 3000 tests.
In my Visual Studio Test task I have enabled "Run only impacted tests" to decrease build time. I have done several builds at the same branch (Git) where I know there are no code changes. So my expectation was that the first build would take more time that if the "Run only impacted test" wasn't enabled because it should do extended analysis.
But then in the next build I would assume that no tests were executed as the code haven't changed.
But what is actually happen is that only 14 tests are "Not impacted".
Do you know why?
TIA is presently scoped to the following:
Supported
TFS 2017 Update 1 onwards and on VSTS
Version 2.* of the Visual Studio Test task in the build definition
Build vNext, with multiple VSTest Tasks
VS2015 Update 3 onwards on the build agent
Local and hosted build agents
CI and in PR workflows
Git, GitHub, External Git, TFVC repos
IIS interactions (over REST, SOAP APIs), using HTTP/HTTPS protocols
Automated Tests
Single box topology (tests and application must be running on the
same machine)
Managed code (any .NET Framework application, any .NET Service)
Not yet supported
Multi box topology (where the test is exercising an app deployed to a
different machine)
Data driven tests
Test Adapter-specific parallel test execution
.NET Core
UWP
Please check whether you have a supported scope. More details please refer to the blog below:
https://blogs.msdn.microsoft.com/devops/2017/03/02/accelerated-continuous-testing-with-test-impact-analysis-part-1/
In VS2013 you can run the compiler for native code with the /analyze flag that will generate .xml files holding the output of the analyze. This will be interpreted by the UI and shown to the developer.
Is there a solution on how to integrate this into a Jenkins build or are any tool which can read such .xml files like the vc.nativecodeanalysis.all.xml and display it as a web page?
Jenkins is essentially a dashboard that outsources tasks to other tools to "do their thing".
With .NET builds your only option is a freestyle build with heavy use of Windows Batch command post build steps or MSBuild steps. Jenkins only knows the path to MSBuild that you tell it in "Manage Jenkins > Configure System"
After that it will outsource msbuild Post Build steps to MSBuild with the parameters you pass it.
Jenkins can consume JUnit test results and many other tools are written to convert test results into JUnit for Jenkins to consume. The mountain is brought to Jenkins rather than the other way around.
If MSBuild doesn't produce a graph, Jenkins unfortunately won't be able to.
You might keep an eye on the Static Analysis plugin over time to see if it adds support for this.
I am trying to improve our general automation process. We use VS2012 and TFS2012.
Here is what I want to happen upon checkin to our CI branch:
BUILD
Build the selected projects / solutions as configured in the build definition settings.
Generate a deployment package that can be used to deploy the websites (without having to rebuild the entire project again)
Generate a nuget package that can later be published (without having to rebuild the entire project again, i need the dlls to match the symbols created from indexing so we can debug them)
TEST - IF AND ONLY IF BUILD WAS SUCCESSFUL
Run all configured unit tests.
DEPLOY - IF AND ONLY IF ALL UNIT TESTS PASS This is to prevent breaking changes entering our development environment
Take deployment package from (1.2) and publish it to it's intended environment (hopefully configured using Publishing Profiles and transforms)
PUBLISH - IF AND ONLY IF ALL UNIT TESTS PASS
Take nuget package from (1.3) and publish it to our private nuget gallery
I don't need a full tutorial (although that would be awesome) for the entire process, but more how to go about integrating it.
For instance:
Should I use msbuild on a wrapper project?
How do I deal with creating the packages upon build on the TFS build server?
How can I enforce the "IF AND ONLY IF ALL UNIT TESTS PASS" constraints?
What is the best / easiest way to perform the deployment /publishing after as part of the build.
This is the process we want to use and any help is realising this is very much appreciated.
And I'm sure many other people are interested in how to set about integrating this style of process.
Also if it's relevant most solutions have a mix of shared dll projects, websites / apis, and unit tests. One of the reasons I want this process is to be able to split them up and modularise our large dlls into smaller isolated units, which would be to unmanageable ATM without this auto publish mechanism.
Thanks,
Gary.
BUILD Build the selected projects / solutions as configured in the build definition settings. Generate a deployment package that can be
used to deploy the websites (without having to rebuild the entire
project again)
This is out of the box, add deployment profile to your projects, call them 'Release'
Add the following to your MSBuild Arguments
/p:DeployOnBuild=true;PublishProfile=Release
you don't have to use Release, as long as your Publish Profiles match what you put in the MSBuild arguments
This will generate the deployment files as part of your build (MSDEPLOY)
Generate a nuget package that can later be published (without having to rebuild the entire project again, i need the dlls to match the symbols created from indexing so we can debug them)
See Nugetter on code plex http://nugetter.codeplex.com/
TEST - IF AND ONLY IF BUILD WAS SUCCESSFUL Run all configured unit
tests.
Should be out of the box, but you can change the build template to fail the build should compilation be unsucessful, if this suits your needs better.
DEPLOY - IF AND ONLY IF ALL UNIT TESTS PASS This is to prevent
breaking changes entering our development environment Take deployment
package from (1.2) and publish it to it's intended environment
(hopefully configured using Publishing Profiles and transforms)
PUBLISH - IF AND ONLY IF ALL UNIT TESTS PASS Take nuget package from
(1.3) and publish it to our private nuget gallery
See Nugetter on codeplex as listed above
I have started using the preview of Microsoft Team Foundation Service (TFS in the cloud, henceforth TFService) for a small project, and I'm currently setting up builds using the online build service included with TFService.
What I want to do is to add an installer of some kind. I've previously worked with InstallShield Limited Edition, WIX and Inno Setup and would like to keep using one of those if possible.
I've previously integrated Inno Setup as part of a build process (TFS 2010). This involved installing Inno Setup on the build computer, and adding a custom build task for running an inno setup script. The last part should be possible with TFService as well, because it's possible to create custom build process templates.
However, I realize that installing anything such as Inno Setup or InstallShield will not work with TFService, since it's not possible to install any 3rd party software on the build computer (it's just a cloud service running on some unknown virtual computer which I cannot access).
So my question is; is there a way to automatically create an installer as part of a build process running on TFService? For example, is the build service capable of building installshield projects out of the box (there's a license included with Visual Studio after all)? Or are there other ways to do this?
I have some experience with this trying to get WiX and InstallShield to work with Microsoft TFS Preview cloud service using their managed build agents. On these agents, you don't have administrator rights and you can't install software.
This currently rules out InstallShield which must be installed.
It is however possible to check the WiX binaries into source control and pull them down as part of your build.
WiX uses .wixproj files (MSBuild) to define their project compile activities. This references a targets file and other properties ( referencing registry values ) that won't exist when you deploy this way. A small bit of hacking will get all of these properties to resolve to workable values.
The one problem you may still have though (and I'm thinking TFS managed build environment ) is that you may have to configure your projects to skip MSI ICE validation suites. On the build machines, I played on the windows installer service was outright disabled and this prevented the tests from running.