0

We have a developer with a similar issue to the one linked below:

Build/Publish .NET Core 3.x application with TFS 2018 Update 3.2

We have .NET core 3.1.101 installed on the build server, but when running the build using the .NET Core Installer Tool step, it is not picking up cached versions. It keeps trying to install from the internet, which is not allowed.

Does anyone know the $(Agent.ToolsDirectory)location for TFS build agent on Windows? (We are on TFS 2018)

NOTE: We have placed the 3.1.101 folder in a few locations trying to test. For example, we placed it in the "E:\agent\buildAgentName_work_tool\dotnet" location. *We created the dotnet folder name.

Any thoughts?

EDIT: More log info...

Tool to install: .NET Core sdk version 3.1.1.
Checking if a cached copy exists for this version...
Cache does not contains this particular .NET Core. Will be downloaded and installed.
...
[error]Failed to download .NET Core package. Please ensure that .NET Core sdk of version 3.1.1 exists. Check out: https://github.com/dotnet/core/blob/master/release-notes/releases.csv

AND screen of step being used in TFS:

TFS 2018 NET Core Installer Tool

1 Answers1

1

Agent.ToolsDirectory

The directory used by tasks such as Node Tool Installer and Use Python Version to switch between multiple versions of a tool. These tasks will add tools from this directory to PATH so that subsequent build steps can use them.

You could refer our official doc here : Use predefined variables-- Agent variables

Since you are using your own agent, kindly learn about managing this directory on a self-hosted agent.


Update

enter image description here

And then point to the agent, and open the capabilities tab and Click Add capability.

Input Agent.ToolsDirectory in the left blank, and add the file path where your xxx installed. For example, I installed it in the file _work_tool of my agent.

More details take a look at answer in this question: How to configure different versions of Ruby / any other software in self hosted agent?

PatrickLu-MSFT
  • 49,478
  • 5
  • 35
  • 62
  • Thank you for these links. I am still not sure where the environment variable AGENT_TOOLSDIRECTORY is located that overrides the work-tool directory. I cannot locate it in system or environmental variables. – CipherSnake May 13 '20 at 15:47
  • @CipherSnake Sorry for the misunderstanding. I get your point. Seems you just want to know how to configure the `Agent.ToolsDirectory`, you could add capabilities in your self-host agent. – PatrickLu-MSFT May 14 '20 at 08:55