在 Azure DevOps 中安装 Mono 以进行 Nuget 部署

Ton*_*llo 6 mono azure nuget azure-devops

我有一个存储库,用于构建 Nuget 包并将其部署到 Azure DevOps 中的 VSTS 源。效果一直很好。但我的空闲时间用完了:(

因此,现在我将使用 VMSS ado 代理,用于部署到 Azure 应用服务。(Linux)

因此,我将 pool: agentname 添加到我的 yaml 中。但是,我现在在推送时遇到单声道错误。

##[error]Error: Unable to locate executable file: 'mono'. Please verify either the 
file path exists or the file can be found within a directory specified by the 
PATH environment variable. Also check the file mode to verify the file is executable.
Run Code Online (Sandbox Code Playgroud)

VMSS不是我创建的,所以我不知道是否安装了mono。但是,该代理用于构建和部署 .net core 5 应用程序,所以???我查了一下,我认为它没有安装(我不熟悉Linux命令,但我尝试过:mono、find,这些都表明没有安装)。

有没有办法只为 nuget 部署(作为管道的一部分)安装 mono,还是我需要搞乱 VMSS?

在此输入图像描述

Ton*_*llo 4

用我用过的解决方案回答。

如果您使用 Linux 作为代理并使用 Nuget,则必须在代理计算机上安装 Mono。Nuget 在 Linux 上使用 mono。就是这样。如果你可以在 Linux 机器上安装 mono,我认为这是另一种解决方案。我没有找到一种简单的方法来安装单声道作为工作的一部分 - 而且我认为无论如何这都会太重(除非它是一个检查,如果没有安装,则安装)。

相反,由于我使用的是 Azure DevOps,所以我使用 dotnet cli 将包推送到源,这与 Nuget 版本几乎相同(唯一的变化是任务)

- task: DotNetCoreCLI@2
  displayName: 'Push'
  inputs:
    command: 'push'
    packagesToPush:'$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg'
    nuGetFeedType: 'internal'
    feedsToUse: 'select'
    vstsFeed: 'your feed'
    publishVstsFeed: 'your feed'
    allowPackageConflicts: true
Run Code Online (Sandbox Code Playgroud)

我回来了!