Self-hosted Azure DevOps build agent on Windows
OS: Windows Server 2019
Build agent installation path: D:\Agent
The idea is to have a build agent with as few installations as possible. Instead using tool tasks like Use .NET Core in the pipelines.
Agent
Prepare your Azure DevOps on-premises environment with the latest agents: https://hanskindberg.wordpress.com/articles/azure-devops/azure-pipelines-agent/update-agents-for-azure-devops-on-premises/
Build Tools for Visual Studio
To be able to build .NET Framework applications I think we need the build tools. The Build Tools versions follow the Visual Studio versions. Download at https://my.visualstudio.com.
I tried with Build Tools for Visual Studio 2022 first but then the VSBuild@1 task was not supported:
- [error]No agent found in pool Windows which satisfies the following demand: visualstudio. All demands: msbuild, visualstudio, Agent.Version -gtVersion 2.194.0
Probably because the solution I tried to build was created with 2019. I do not know.
So instead I installed Build Tools for Visual Studio 2019.
I had to reconfigure the agent after the installation of the Build Tools.
In my case:
D:\Agent>config remove
and then config again:
D:\Agent>config
Information:
Python
To use the Npm@1 task we need Python 2. To use the UsePythonVersion@0 task we need to have the Python files.
Download a Python installation:
To avoid “shiting” the build agent with a Python-installation I created a Windows Server 2019 Datacenter in Azure and installed with the following command:
C:\Users\MyUserName\Downloads>python-3.10.0-amd64.exe /quiet Include_launcher=0 InstallAllUsers=0 TargetDir=D:\Agent\_work\_tool\Python\3.10.0\x64
- https://stackoverflow.com/questions/60936103/install-python-to-self-hosted-windows-build-agent#answer-66768677
- https://docs.python.org/3/using/windows.html#installing-without-ui
Then I zipped the Python-directory and copied it to my local machine. Then I unzipped and copied the Python-directory to the build agent:
- Destination: D:\Agent\_work\_tool
Then I created an empty text-file and named it “x64.complete” here:
- D:\Agent\_work\_tool\Python\3.10.0\x64.complete
Then I did the same with Python 2:
C:\Users\MyUserName\Downloads>python-2.7.17.amd64.msi /quiet Include_launcher=0 InstallAllUsers=0 TargetDir=D:\Agent_work_tool\Python\2.7.17\x64