如何在 Azure Devop YAML 中添加 .Net 3.5.1 作为先决条件?

How to add .Net 3.5.1 as a prerequisite in an Azure Devop YAML?

我们目前有一个基于自定义代理的 .Net 解决方案。我只需要安装一个新代理,我们注意到构建失败,因为我们的 2 个工具都在请求它。

有没有办法在 YAML 中强制安装 .Net 3.5.1?

谢谢!

How to add .Net 3.5.1 as a prerequisite in an Azure Devop YAML?

您可以利用为构建管道中指定的代理和需求定义的自定义功能。如前所述 here:

The agent software automatically determines various system capabilities such as the name of the machine, type of operating system, and versions of certain software installed on the machine. Also, environment variables defined in the machine automatically appear in the list of system capabilities.

因此,您的 self-hosted 代理可以定义一些特殊的环境变量,例如:

pool:
  name: Default
  demands: DotNetFramework_3.5

您可以查看线程 Specify demands 了解更多详细信息。