Search code examples
azureazure-devopsnugetmono

Install Mono for Nuget Deployment in Azure DevOps


I have a repo that builds and deploys a Nuget package to a VSTS feed in Azure DevOps. It's been working great. But I ran out of free minutes :(

So now I am going to use a VMSS ado agent that is used for deployments into Azure App Services.(Linux)

So, I added pool: agentname to my yaml. But, I am now getting a mono error when pushing.

##[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.

The VMSS was not created by me, so I do not know if mono was installed. However, this agent is used to build and deploy .net core 5 apps, so??? I checked and I don't think it's installed (I am not familiar with Linux commands, but I tried: mono, find, which and all dictate no install).

Is there a way to install mono just for the nuget deployment (as part of the pipeline) or do I need to mess with the VMSS?

enter image description here


Solution

  • Answering with the solution I used.

    Mono must be installed on the agent machine if you're using Linux as your agent and using Nuget. Nuget uses mono on Linux. So that's that. If you can install mono on your Linux machine, that, I think, that is another solution. I did not find an easy way to install mono as part of the job - and I think that would be too heavy anyway (unless it was a check and if not installed, install).

    Instead, since I am using Azure DevOps, I used the dotnet cli to push the package to the feed, which is remarkably, nearly identical to the Nuget version (the only change was the task)

    - 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
    

    And I am back in!