I have TFS On-Premises, and I have this errror when queueing a new build.
No agent could be found with the following capabilities: msbuild, visualstudio, vstest
I found this answer: No agent could be found with the following capabilities: msbuild, visualstudio, vstest?
But is there any way to fix it on-premises without installing Visual Studio on the build server?
I had this issue with Visual Studio 2017 installed on the build server (on-prem):
No agent could be found with the followin capabilities msbuild,visualstudio, vstest
When I upgraded a Test Controller the Build Agent lost some of its capabilities, such as VSTest:
I added these capabilities back as User Capabilities:
MSBuild_15.0 = C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\
MSBuild_15.0_x64 = C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\amd64\
VSTest = C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TestWindow
VSTest_15.0 = C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TestWindow
VisualStudio = C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\
VisualStudio_15.0 = C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\
VisualStudio_IDE = C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\
VisualStudio_IDE_15.0 = C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\
Then I got the infamous error:
MSBuild not found for version '15.0' and architecture 'x86'
I searched the web high and low, I did so many things to try and resolve this issue, I finally found this saying its been fixed in TFS update 2.
I upgraded TFS from update 1 to 2 and that did fix the problem.
If you don't want to install VS on the build server you could add a new build agent and install VS there.
Related
I am creating a generic script to deploy on the build server to build our project using VS 2019. The location of nmake in VS 2019 is at: C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\bin. The inclusion of numbers like 14.29.30133 doesn't allow the script to be very generic.
In the earlier generations of VS, nmake paths were like: C:\Program Files\Microsoft Visual Studio 10.0\Vc\bin or C:\Program Files (x86)\Microsoft Visual Studio 11.0\Vc\bin
Maybe I installed MSVC incorrectly? Any help is appreciated. TIA.
You installed MSVC correctly, and yes, this can cause some headaches, because the version number in the folder name changes with every new minor release of VS 2019.
To resolve this, use this command line snippet for getting the path to the latest installed nmake.exe into the variable %NMAKE%:
set VSPATH=C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional
for /f %%i in ('dir "%VSPATH%\VC\Tools\MSVC" /b') do set VCTOOLSVERSION=%%i
set NMAKE="%VSPATH%\VC\Tools\MSVC\%VCTOOLSVERSION%\bin\HostX86\x86\nmake.exe"
This works for all intermediate versions of Visual Studio 2019 I tested it with.
What is the location of vcvarsall.bat file for Visual Studio 2019 (Preview and future release as well)?
Seems it is different from VS 2017 "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat"
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat"
As it turned out the path is very similar, just without "Community" part:
For VS2019:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Auxiliary\Build\vcvarsall.bat
For VS2022 since the toolchain now is 64-bit:
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat
If after installing the "Build Tools for Visual Studio 2019" and doing all that was recommended in the other answers, you still can't find the the file in the location mentioned (no Build folder inside Auxiliary) make sure you
Install "Desktop Development With C++ Workload"
because vcvarsall.bat is part of C++ workload.
(In VS, go Tools menu -> Get Tools and Features -> Install the Desktop Development With C++ workload)
You need to install the "Build Tools for Visual Studio 2019" which can be found here.
See the explanation:
You can build C and C++ applications on the command line by using tools that are included in Visual Studio. The Microsoft C++ (MSVC) compiler toolset is also downloadable as a standalone package from the Visual Studio downloads page. It's part of the Build Tools for Visual Studio package. You can choose to download only the tools you need for C++ development.
If you are using it in the pre-build event, you can execute the vcvars32.bat to set the environment variable VCINSTALLDIR and get rid of the Visual Studio version:
call "$(DevEnvDir)....\VC\Auxiliary\Build\vcvars32.bat"
Then
"%VCINSTALLDIR%\Auxiliary\Build\vcvarsall.bat"
Note:
-In my tests, the variable VCINSTALLDIR has value only after executing the vcvars32.bat
-As Wei Yang said you need to install "Build Tools for Visual Studio 2019", it can be installed using Visual Studio Installer.
I felt free to add a possible solution.
1.) Open the Developer Command Prompt for your wanted VS if you have more than one installed. BTW this lets you work with TFS tool tf if you need it.
2.) Add in your make script the following code at the concerning location:
for /f "delims=" %%d in ('dir /s /b %VSINSTALLDIR%\vcvarsall.bat"') do #set myVCVARSALL=%%d
if not defined myVCVARSALL exit 1
call %myVCVARSALL%
Hope that helps to find this file for the wanted VS version. It results in different files for different installations.
I needed to install and build some older build tools for windows. So, I had to set the location.
The location is C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build
If you haven't installed the "Build Tools for Visual Studio 2019", you can do so from https://visualstudio.microsoft.com/downloads/.
Once this is done, the correct path for running vcvarsall.bat is;
"C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvarsall.bat"
For VS 2019 Professional, it is "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvarsall.bat"
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat this is the location.
I've installed TFS (version 15.112.26307.0) on windows server 2012 R2. all team members use VS2017 to coding. I've created an agent (I've tried versions vsts-agent-win7-x64-2.112.0, 2.117.0 ,2.140.0)and set it's MSBuild version to MSBuild15.0 :
MSBuild15.0 has already installed on the server :
But when we use c# 7 features in our code(like "int out x") building code via TFS raise error as below (it use MSBuild14.0 to build our code, why?)
My agent capabalities is not correct :
Use the Visual Studio Build task. It allows you to specify the Visual Studio version used to run builds.
Seems the capabilities cannot be detected by the agent. If you have installed the VS 2017 on the build agent server, then you can try to restart the agent service to check if that works.
If that still not work, you could try below things:
Add the capabilities manually.
The path of them are(Enterprise version for example):
VisualStudio_15.0 C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\
VisualStudio_IDE_15.0 C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\
MSBuild_15.0 C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\
MSBuild_15.0_x64 C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\amd64\
VSTest C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common\IDE\CommonExtensions\Microsoft\TestWindow
Specify the path to Msbuild 15.0:
We have TFS 2015 server and also a build server with Visual Studio 2017 Ultimate. TFS agent is not able to detect VisualStudio or VsTest capabilities (as it should) but when added manually, there is still a problem.
When it comes to Visual Studio Test step then console shows the following error and fails:
c:\AgentTest\tasks\VSTest\1.0.30\VSTest.ps1
Unable to determine the location of vstest.console.exe
I added the following capabilities manually:
VisualStudio C:\Program Files (x86)\Microsoft Visual
Studio\2017\Enterprise VisualStudio_15.0 C:\Program Files
(x86)\Microsoft Visual Studio\2017\Enterprise
VisualStudio_IDE C:\Program Files (x86)\Microsoft Visual
Studio\2017\Enterprise\Common7\IDE
VisualStudio_IDE_15.0 C:\Program
Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE
VS150COMNTOOLS C:\Program Files (x86)\Microsoft Visual
Studio\2017\Enterprise\Common7\Tools\
VSTest C:\Program Files
(x86)\Microsoft Visual
Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TestWindow
VSTest_15.0 C:\Program Files (x86)\Microsoft Visual
Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TestWindow
This is my Visual Studio Test settings:
I can reproduce this issue, TFS 2015 agent cannot identify VStest and some other 2017 related capabilities.
Based on the test, TFS 2015 should not support for 2017 VStest.
According to this Github discussion, it seems that the core issue is the Visual Studio Test task needs updated to support VS 2017.
In TFS 2017 and VSTS, we can specify the absolute path of the vstest.console.exe to let it work (See this article for details), but in TFS 2015 we can not specify the path in the task, it's not support.
So, if you want to use Vstest, you can install VS 2015, or upgrade to TFS 2017 or later version.
Similar thread for your reference: https://social.msdn.microsoft.com/Forums/vstudio/en-US/1f9992f3-20b6-437a-855d-ccd67ff2298e/using-tfs-2015-with-build-agent-and-visual-studio-2017?forum=tfsadmin
I`m building an extension for Visual Studio Team Explorer and a line of code like this:
ITeamExplorer teamExplorer = GetService<ITeamExplorer>();
needs a reference to Microsoft.TeamFoundation.Controls.dll
which i couldn't find any where in TFS2015
I have VS 2015 Pro installed. Found it at
**C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer**Microsoft.TeamFoundation.Controls.dll
If you have Visual Studio 2015 installed you should be able to find it at C:\Program Files\Common Files\microsoft shared\Team Foundation Server\14.0\Microsoft.TeamFoundation.Controls.dll; at least, that's where it is on my machine.
Also, I'm not sure if it's required, but I also have the Visual Studio Extensibility Tools installed, which is one of the optional items listed during the installation of Visual Studio 2015.
You can search and find it under this path:C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions
I found it under C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\mcjvkcdg.wd1 on my dev machine.