Jenkins slave machine Windows configuration - jenkins

I am very new to Jenkins and sort of new to build .net application, but the guy left team so I have been assigned to do this. I have read tons of articles online about setting up Jenkins master, but little about slave configuration. The guy created a new slave and connect with Jenkins master successfully before he left. And he told me that slave is responsible for 1) downloading source code from TFS server and 2) building them.
now my issue is what do I need to install in the slave machine( windows system) to be able to perform that two tasks?
1) for downloading source code, do I need to install TFS client on slave ?
2) for building source code, do I need to install MSbuild or entire Visual studio ?
Thank you very much !

Assuming you installed a recent version of the Team Foundation Server Plugin, then no TFS Client is required (see https://github.com/jenkinsci/tfs-plugin#400-and-later-new).
Depending on what you are building, installing Visual Studio maybe required or not. In my experience, only a limited set of project types build with just MSBuild and without Visual Studio. There are hacks or supported tips but they work only in specific cases: YMMV.
The new Build Tools for Visual Studio 2017 RC are making this requirement a thing of the past: if you can migrate your code to Visual Studio 2017 you will be able to use them.

Related

Visual Studio Online - Error TFS 22501 with XAML Build Definition 2

Currently, we are using TFS 2012 and we have a heavily customized build process as described below.
1. Build the source
2. Run an EXE as console to host WCF services
3. Restore databases on local sql server
4. Run functional test
5. delete databases
6. close the exe started in step 2.
7. Create an Installable exe using WiX ( Wix with custom bootstratpper)
8. Update version number file to TFS
Now we want to move to Visual Studio online from onpremise. Trying to setup a build process with Private Build agent. I have created an VM , installed and registerd agent. I do see agent name back in website.
When I go back to Visual studio and try to create new xaml build definition I am getting below error.
TFS22501: Creating a build definition requires a build controller be defined for this team project collection. There may not be any controllers configured or you may not have permissions to view them. contact your team foundation server administrator.
can somebody please help ?
If you're using XAML build, you have to use the old-style XAML build controller/agent. The VSTS agent is for the new build system.
I would strongly recommend migrating your builds to the new build system as part of your migration to VS Team Services, as the XAML build system is effectively dead.

How do I install prerequisites for TeamCity to connect to Team Foundation Server Version Control?

I've installed the prerequisite (Team Explorer 2013) to the best of my knowledge, but when I try to set up a VCS root to connect to our TFS Version Control server, I continue to get this error message:
"No TFS assemblies were found on the system. Please make sure you have
Microsoft Team Explorer installed. Supported versions: 2015 2013 2012
2010 2008 2005"
The Team Explorer I downloaded from Microsoft just seemed to be a plugin for Visual Studio, which doesn't make much sense as a server-side component. Anyway, I configured a connection to our TFS box within Team Explorer/Visual Studio on my TeamCity server.
So I have two questions that seem to be undocumented by JetBrains:
What does it mean to set up and configure Team Explorer? How can I validate that I have set up and configured Team Explorer on my TeamCity server correctly?
How does TeamCity know how to find the Team Explorer assemblies? Is there some sort of configuration I am supposed to do? Where is this documented?
I guess I'm looking for a true step-by-step set of instructions that make no assumptions about my understanding of TFS or Team Explorer, or any assumptions about what I may have already installed on my TeamCity box.
I've read the two articles on the JetBrains site regarding how to set this up, and they don't cover actually installing and configuring the prerequisites or configuring TeamCity to discover the Team Explorer assemblies it needs.
Team Explorer is the client software that you use to access Visual Studio Team Foundation Server functionality from Visual Studio. You can simply launch Team Explorer on your TeamCity server to create a team project and check in a project, to validate whether it is installed correctly.
I couldn't find any documentation that mentioned how does TeamCity find Team Explorer assemblies. But, based on my understanding, there is no configuration needed to detect Team Explorer. Please make sure your TeamCity server is running under Windows.
If the issue that can't find Team Explorer persists, you can install VS Premium instead of Team Explorer.
Setting up Jetbrains TeamCity for CI with Team Foundation Server:
Install Jetbrains TeamCity
If you are planning on using IIS or TFS on the same server, configure Jetbrains TeamCity to run on a port other than 80 or 8080
Once TeamCity is up and running, you can begin configuring your TeamCity installation for CI Builds.
Log into TeamCity with your user name and password
Create a new TeamCity Project
Create a new build configuration
You will now see a series of build configuration settings that you will have to complete presented in a Wizard-style navigation view.
Enter General Settings
Enter VCS Settings
After entering VCS Settings, Create and attach new VCS Root
Enter the relevant information for your TFS instance
Create a Build Step using Visual Studio as your build runner. You can create as many build steps as you need and specify the order of the steps (similar to a TFS Build Workflow).
For setting up Continuous Integration builds, you will need to specify a Build Trigger. CI Builds will generally use a VCS Trigger that is triggered on each source control check-in.
If you need to pass any parameters to your build, you can configure these in your Build Parameters.
That is all! You can then either run your Builds manually by clicking on the Run button in TeamCity or simply verify that your builds are triggered by the next check-in into TFS.

Error 'No agent could be found with the following capabilities: msbuild, visualstudio, vstest'

I'm setting up a new build server using TFS 2015 and after I configured the agent, when I tried to queue a build I got this error:
No agent could be found with the following capabilities: msbuild, visualstudio, vstest
How can this be resolved?
Install Visual Studio on your build agent, then restart the build agent. Restarting the build agent will capture the added Capabilities.
Note: First of all, you can do all this with the community edition and TFS Express 2015 on your own server (for free up to five users) - so don't worry about needing to use the Visual Studio online version or paying for Visual Studio Professional.
It is very easy to misinterpret the error message provided and go off on a wild-goose chase trying to debug it.
Unfortunately the message itself is just badly worded and that's the real problem.
Here is what that error message really means:
"No agent could be found with the following capabilities: msbuild,
visualstudio, vstest.
In fact I didn't actually find ANY build agents configured for the selected build queue."
So you're thinking that doesn't apply to you because you just created a build agent?
Well, maybe you did, but here's what probably happened:
You created a new pool (for no reason other than you just thought you ought to).
You then created a queue under that pool.
You ran the PowerShell script to create an agent and you assumed it put it in the pool you just created....
But it didn't - it put it in the 'default' pool which you aren't even using...
Aha!
So here's what happens when you build:
You select a queue from the dropdown.
TFS tries to build by looking for the pool that corresponds to that queue and it doesn't find any agents AT ALL there, so you get a stupid useless red-herring error message.
When I finally realized what happened I just deleted my cutely named pool + queue and just reverted to using the default pool.
Next time I will try to pay more attention to this message during the PowerShell configuration:
Configure this agent against which agent pool? (default pool name is
'default')
You will have to create a queue under the pool, but then your agent should start working.
If you have a genuine with a certain capability being absent from your agent you can check what your agent supports via the 'capabilities' tab shown here. Of course msbuild, visualstudio and vstest are all here :-)
In my case, after installing MSBuild (https://www.visualstudio.com/downloads/, search for "Build Tools for Visual Studio 2017"), I just had to add the path to MSBuild to the PATH environment variable. The agent wasn't detecting MSBuild until I did that.
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin
I did NOT have to install the full Visual Studio IDE. The selected answer for this question is just plain wrong...
By default, when using the new build system on VSO, it doesn't pick the hosted build option, which is how I ended up on this post in Stack Overflow. If you are used to using a VSO build server here's what you need to do:
Create a hosted build by going to the General tab and changing your Default Queue to hosted. More on the restrictions of that and how it works here: https://www.visualstudio.com/get-started/build/hosted-agent-pool
Add them as User-defined capabilities, e.g.:
visualstudio C:\Program Files\Microsoft Visual Studio\2022\Community
vstest C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\TestWindow
I had initially installed the agent on a machine that did not have Visual Studio installed. However, after installing Visual Studio (and then Visual Studio Build Tools), restarting/recreating my agent, restarting my machine, etc., I could not get the agent to detect the new capabilities automatically, so I added them myself in Azure DevOps as User-defined capabilities.
I had this issue and it turned out being my release process had selected the "wrong" agent. Just edit the release and set the correct agent queue
I was using a Xcode build slave for building an Xcode project.
And the error message I ended up with in TFS 2015 was
"No agent could be found with the following capabilities: xcode"
I registered an OS X on-premise build slave.
In the "Register Agent" step, I named by build agent:
>> Register Agent:
Enter agent pool (press enter for default) > My-Xcode-Agent-Pool
So, I had to select the "My-Xcode-Agent-Pool" as Default queue in the build settings. Source: Microsoft-hosted agents
Although none of previous answers worked for me, the post by Simon_Weaver pointed me in the right direction.
He mentioned that vstest was in his list, but it wasn't in mine. I fixed it by adding a user-defined capability named "vstest" with the full path to vstest.console.exe under Visual Studio 2017.
What ended up working for me was to go to where I downloaded the agent and running:
./config.cmd remove then ./config.cmd to reinstall the agent from the command line inside the directory of my agent.
Download agent
per microsoft https://msdn.microsoft.com/en-us/ie/bb399135(v=vs.94)
You must install on the build agent the version of Visual Studio that your team uses on its dev machines. See Installing Visual Studio. You must also install any other software and components that are installed on your dev machines and that are required to build your app.
In my case, after installing MSBuild, restart all Azure services (in windows service) and it worked. No need to install full Visual Studio
You have to install the correspondent Visual Studio version on the build machine (where you have installed your agent). This will add the required tools and capabilities to the server.
Visual Studio is required, because it installs all the build targets required to build your projects.
After being installed, you have to restart the agent Windows service so that it refreshes the list of capabilities.
Since you are using the Visual Studio installation on the build machine to build, that installation doesn't count as an additional license.
General solution for TFS:
The common way of resolving most of the issues on the build server is to install Visual Studio & all dependent packages on your build server.
Alternative solution in case of using VSTS
When you choose where to build, use "Hosted"
and then the build will work.
The guide how to make it work may be found here: Deploy an agent on Windows for TFS 2015
Check the agent section which will contain information about capabilities.
Updated:
Once you have the list of capabilities in vsts(azuredevops)
you might need to install the desired software on your build agent machine.
PS Be aware, you might have to license your sw, if required.

What version of Visual Studio is required for building Web/MVC apps using TFS Build?

We're deploying a set of Build Controllers and Agents throughout our infrastructure to build Web/MVC applications and deploy them using Release Management through TFS 2013.
I read that we need to have Visual Studio installed on the build machines to compile properly, and would like to know if we are able to use Visual Studio Shell (Integrated? Isolated?) or if we need to dedicate a full (Ultimate or Professional) Visual Studio to it.
Thanks in advance--
==Update 10:33 5/5/2014==
Due to the security restrictions placed on our development group, we are unable to use off-premise resources.
==Update 12:47 5/5/2014==
Installing the MSBuild Redistributable (via Erik Funkenbusch) was a good start, and following Jimmy's advice sealed it. Thanks!
The components needed to build Web Applications (of which MVC is a subtype) are in \Program Files (x86)\msbuild\Microsoft\VisualStudio\v12.0\WebApplications (or whichever version of VS you're building against). While these are installed by VS, you can just xcopy them to your build servers without the rest of the VS installation.
No, you don't need Visual Studio installed on the build machine, and wherever you read that... run far away, because they don't know what they're talking about.
In fact, it's explicitly recommended to NOT install Visual Studio on the build machine.
Microsoft has a full MSBuild redistributable with 2013 components. MVC is installed as part of the build via Nuget (along with other components).
http://www.microsoft.com/en-us/download/details.aspx?id=40760
In past years, you had to install the Windows SDK, and do a lot of manual configuration, and that was a pain. With 2013, they've made this much simpler.
I believe the Release Management should also have an installation setup file to install components for build servers....
You don't need Visual Studio for just doing compilation as part of the build process. If you have unit test cases which needs to be run then you need Visual Studio.

What am I doing wrong - problems building using TFS 2012

I am trying to get the most basic configuration of TFS 2012 up and running.
So far I installed the TFS server using the simplest option (the 1st option in the installer - the one that comes with a bundled SQL express),
I configured the build service (1 controller, 1 agent, both on the TFS machine).
My project consists of 2 parts: a C#/silverlight part, and a C++ part.
After adding the silverlight prerequisites the C# project builds correctly.
However I can't get the C++ project to build.
I guess I am missing a prerequisite since I am getting the following errors:
C:\Builds\1\proj1\Client\src\Code\Client\proj\main (VC11).vcxproj
(19): The imported project "C:\Program Files
(x86)\MSBuild\Microsoft.Cpp\v4.0\v110\Microsoft.Cpp.Default.props" was
not found. Confirm that the path in the declaration is
correct, and that the file exists on disk.
Indeed, the TFS server does not have a "C:\Program Files (x86)\MSBuild\Microsoft.Cpp" folder (while my dev machine has one).
I installed the windows SDK, but that didn't help.
I saw on some posts that I need to install VS 2012 on the build machine. Is that correct? will VS express do?
I have been banging my head on this for the last 2 days, and any help would be appreciated.
Installing Visual Studio on your build server seems like a strange thing to do, but having been around the TFS block a bit, I have found it to be the simplest way to manage build servers.
You can copy the files manually from your dev machine to your build server, but if an update to visual studio comes out, you will need to figure out what has changed and make sure you update all those files too. These files typically include Targets files and associated dlls.
Also with all the extensions and packages that are available now, it is just easier to load Visual Studio on your build server and install the required packages than try to work out what is needed to replicate the functionality.
This was made very clear to me recently when Microsoft released ASP.Net and Web Tools 2012.2. This altered the publishing pipeline for Web Sites and Web Projects and I needed to use this in my TFS build. It was so much easier to just be able to log onto my build server, load Visual Studio and download the new update.
I would definitely support installing Visual Studio on your build server.

Resources