What is required on a build agent for doing more than simply building the project? - msbuild

Successfully building an MVC project using a basic build agent, meaning an agent created using only the TFS 'Agent Pools' download and setup process.
From reading many SO posts and observation while trying to add Tasks to my Build Definition I have come to understand that a 'basic' Build Agent can build a project but seemingly do little else. For example, I understand that to run unit tests on the Build Agent, Visual Studio will need to be installed. But I had (naively) assumed at least MSBuild was installed on the Build Agent; it seems not.
Question 1: Please confirm if MSBuild must be installed in order to add additional MSBuild tasks to my Build Definitions? Can I install just MSBuild?
Question 1a: If MSBuild is not on the basic Build Agent, what is the Build Agent using to build projects?
Question 2: If I want to do unit tests on the Build Agent, will the free VS version (Community 2017) be sufficient, or do I need to install the full version of VS? (I am running full VS/TFS onsite versions) Some other forums suggested in prior year versions the free VS version (I believe called Express) was sufficient for unit testing on Build Agents.
Question 3: Are these the only 2 'levels' of added packages I would ever need on a Build Agent, MSBuild or VS? And if I only installed MSBuild at first, would I run into problems adding VS to the Build Agent later because it will install MSBuild over the previous MSBuild install?

The agent is just a task runner. If you want to do things that require Visual Studio normally, install Visual Studio. If you want to do things that require, say, NodeJS, install NodeJS.
There is no licensing requirement for build servers, so there is no reason to not install the highest SKU of Visual Studio for which your organization owns licenses.

Related

Building an installer, to install dlls to the gac, with MSBuild

I have a dll project which I need to install into the GAC, on our Production machines.
(I wish I didn't have to use the GAC but SSIS insists)
gacutil.exe is not available on the target machines and using "Enterprise.Services" from PowerShell does not work (I don't know why)
My understanding is I should created a msi installer project.
However after installing the Setup and Deploy Extension to Visual Studio (2015 soon to be 2017), I discovered those projects cannot be built by our Build Server because it uses MSBuild, and MSBuild can't build vdproj project files.
What is the correct way, using a CI build pipeline (MSBuild), to create build artifacts, which can install dlls to the GAC, of a Production Environment?
Note: there are several partial answers on SO, but I could not find any, which were up to date/answer my whole question. Please keep that in mind when answering.
You need to break this down into several user stories. You aren't finding partial answers, you are finding actual answers for specific questions. What you ask is more like an epic.
In general I would create an MSI using Windows Installer XML. WiX/MSI can install files to the GAC without using GACUTIL. If you use the WiX Visual Studio extension "Votive" you can create a .SLN / .WIXPROJ / .WXS that can be built using MSBuild. You can then put this into a source control system such as Git/TFVC/Subversion and use a build system such as VSTS V.Next Build, XAML Build, Concourse, Jenkins to automation the pipeline to build the MSI.

Visual Studio Online build error about NuGet client version (v3.0 or above required)

I am trying to setup a CI build using Visual Studio Online but I am getting the following error about the NuGet client:
The 'System.Net.Http 4.0.0' package requires NuGet client version '3.0' or above, but the current NuGet version is '2.8.60318.667'.
Solution builds and deploys fine directly from my Visual Studio 2015 itself but I am unable to get it to build in VSO. Does anyone if NuGet 3.x is installed on hosted build controllers or if I can supply my own copy along with my solution?
It's hard to guess by the question what build tasks are used. If you use VSBuild/MSBuild, it is only possible to turn "Restore NuGet packages" on, but there's no influence on the NuGet version.
However, if you turn this checkbox off, and instead add another build task called NuGet Installer before the main build step, you'll be able to provide a custom path to NuGet.exe. In the case of hosted build agent, the most obvious option is to commit required version of NuGet.exe to the repo, and then reference it from the build step:
Sounds like a hack, but it might work in your case.

How to define WIX agent requirement in TeamCity?

I have add a WIX installer project to solution in Visual Studio 2013. The project is built with every commit on TeamCity. There are several build agents connected to TeamCity cloud, but only some have WIX installed.
Usually I would add the build agent requirement, so only the computer with WIX installed is selected for automated build.
What requirement should I select? Is there some environment variable I could use after WIX is installed?
I know I can set the environment variable manually on every computer I install WIX, but this is not nice solution for me.
There's a system environment variable called 'WIX', which holds the path WiX Toolset is installed to. It is created during WiX Toolset installation.
However, there might be a better way that avoids setting up any build agent requirements. Take a look at this article that explains how to integrate WiX into daily builds. Basically, it suggests committing the required binaries along with the source code of your app.
Both approaches have pros and cons, it's your choice.
The agent need to be restarted after installing WIX. Then there will be
env.WIX
requirment in the Teamcity.

TFS2010 build with unit test

I am trying to convert a build system setup with TeamCity and Nant scripts to use TFS2010 (We bought the license and might just as well make use of it) After some work I get the web project to build and deploy to the web-server. We have a domain, API, test and web project in our solution.
How do I configure TFS to run the unit tests that we have written so far? I did configure the build to look for ***.UnitTest.dll in(VS2010) Edit build definition>Process>Automated Tests
Now the build fails with a message that says:"Could not load file or assembly 'nunit.framework, Version=2.5.3.9345" Am I correct when I say that TFS is trying to run NUnit on the build server? I did install NUnit-2.5.3.9345 on that TFS2010 build server and still nothing?
Thank you
Jack
The build facility in TFS uses MSTest as test runner, with which it's tightly integrated.
If you want to run your unit tests with NUnit as part of your build, take a look at the NUnit for Team Build project on CodePlex.
The project started out for TFS 2008, however support for TFS 2010 has been added in version 2.0. Note that this feature is still in early stages of development, so your mileage may vary.
I'm late to the game, because I've had to deal with this issue recently. I found this article helpful for me in this. It didn't work right off the bat, but I found if I added it into my buildscript via the controls in a similar manner/pattern, it would work.
My only problem now has been getting it to actually error (right now it warns) even when flagging them to cause the build to error
Link: http://blog.gfader.com/2011/06/running-nunit-tests-in-tfs-2010.html

TFS2010 build for VS2005 Projects

We have migrated few projects from TFS2008 to TFS2010 by using the method-
1.Attch TFS2008 DB to TFS2010 DB
2.Tfsconfig import
3.Delete the project not required.
There are few projects in the migrated projects which use VS2005. They do not want to do any change in their project and want to use VS2005 to work with migrated projects. We have applied couple of patches in VS2005 and now they are able to access the TFS2010 projects from VS2005.
However we are clueless about the build configuration. We have configured build server for their Collection...now what configuration needs to be changed in TFsbuild.proj to make the build run again.
Is there any more steps required to make the build work?
Any help would be very much appreciated.
Thanks Upfront.
Kabir
If you have not had a build definition for you TFSbuild.proj then you will need to create one. In your build definition, you will need to choose UpgradeTemplate.xaml as the build process template. In TFS 2010 this template is used to run legacy build definitions.
See how to run build with the UpgradeTemplate.xaml here.
I also found this useful post in the MSDN Build Automation forum that tells you the differences between 2010 and 2005 build processes.