DevOps for Desktop: How to use Self-Hosted agent for Win10 UWP Desktop Apps in Azure DevOps Pipeline
Published Jul 25 2019 11:08 PM 5,368 Views
Microsoft

Default Azure DevOps Agents are good for general build environments, such as below:

 

selfhostagent.png

 

You can get details of the environment by select the item and click the Details tab:

 

1.png

 

Comparing this offering, self-Host agent is convenient especially your projects have specific SDK dependencies or deployment targets are in-house.

 

Below guidelines are based on my experiences on Continuous Integration/Continuous Deployment Centennial hybrid Desktop apps (UWP, WinForm, .NET Core 3). which should work for most similar tasks requirements.

 

Prepare

 

  1. Get Azure DevOps personal access token (PAT) by following https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/v2-windows?view=azure-devops#permissi...
  2. Create one Win 10 machine, Win10 can be upgraded to 19H1
  3. Install Windows 10 SDK here:

https://developer.microsoft.com/en-US/windows/downloads/windows-10-sdk

 

  1. Install other specific SDKs if you need, for example Microsoft Advertisement SDK:

https://marketplace.visualstudio.com/items?itemName=AdMediator.MicrosoftAdvertisingSDK

 

  1. Install VS2019 here:

https://visualstudio.microsoft.com/vs/

 

  1. By default, Windows 10 has .Net 4.8 now. You can get other versions if necessary, for example, install 4.6.2 SDK:

https://www.microsoft.com/en-us/download/confirmation.aspx?id=53321

 

  1. Download Agent for Windows according to the step:

https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/v2-windows?view=azure-devops#download...

 

2.png

 

  1. Click Download Agent, you will see more details commands, execute them one by one:

3.png

 

You will be prompted to input server url and PAT  (personal access token, it is generated at step 1) while running the config.cmd,  for details just follow this part:

https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/v2-windows?view=azure-devops#server-u...

 

Connect the Self-Host Agent to Azure DevOps

 

If you want to run this Agent as a Service, please open powershell as Admin permission, otherwise you can run run.cmd directly to read job running status in Window, such as:

 

4.png

 

Once the Agent is running, it will read environment info on the Agent host computer and will connect to Azure DevOps Pipelines from HTTPS. You may want to open this outbound connection in case there is some firewall blocked there. Refer to:

 

https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/v2-windows?view=azure-devops#im-runni...

 

After setup and start the Agent successfully, in the Agent Pool you select in config.cmd, you will see the Agent status. I put my agent in ‘Default’ agent

pool here:

 

5.png

 

Configure Build pipeline to run job on the self-host agent

 

In Build Editor, select the Pool as ‘Default’, and then you can trigger it by committing code:

 

6.png

 

 

Configure Releases Pipeline to run job on the self-host agent

 

In Release Editor, you can choose “Default” as the Agent Pool as well in UI, and trigger it by previous build tasks:

 

7.png

 

Now the setup is completed, you can use your own agent to CI/CD Windows Desktop Apps in customized build environment at anytime and leverage the power of Azure DevOps as well!

 

SelfHostAgent_Medium.gif

 

 

 

Co-Authors
Version history
Last update:
‎Nov 22 2022 12:21 PM
Updated by: