0

I was trying to use a self-hosted agent to create my pipeline on azure. But I got this error

##[error]No agent found in pool TestPool which satisfies the following demand: VisualStudio. All demands: msbuild, visualstudio, vstest, Agent.Version -gtVersion 2.182.1

the agent is running without error enter image description here

and pipeline settings YAML file:

trigger:
- main

pool:
  name: TestPool
  vmImage: 'macOS-12'

variables:
  solution: '**/*.sln'
  buildPlatform: 'Any CPU'
  buildConfiguration: 'Release'

steps:
- task: NuGetToolInstaller@1

- task: NuGetCommand@2
  inputs:
    restoreSolution: '$(solution)'

- task: VSBuild@1
  inputs:
    solution: '$(solution)'
    msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactStagingDirectory)"'
    platform: '$(buildPlatform)'
    configuration: '$(buildConfiguration)'

- task: VSTest@2
  inputs:
    platform: '$(buildPlatform)'
    configuration: '$(buildConfiguration)'
  
- task: CopyFiles@2
  inputs:
    contents: '_buildOutput/**'
    targetFolder: $(Build.ArtifactStagingDirectory)
    
- task: PublishBuildArtifacts@1
  inputs:
    pathToPublish: $(Build.ArtifactStagingDirectory)
    artifactName: MyBuildOutputs

I have done the exact same thing on a windows machine, and it works fine, does anyone got any solution for this? Thanks.

Ian
  • 342
  • 1
  • 3
  • 14
  • Use cross-platform commands like `dotnet build` and `dotnet test`. As the error message indicates, `VSBuild` and `VsTest` are only for Windows machines, since there isn't a true port of Visual Studio to MacOS. – Daniel Mann Mar 24 '23 at 22:01
  • Thanks for the advice! Didn't notice that. I'm totally new to c# world. – Ian Mar 25 '23 at 01:26

0 Answers0