I can build my code locally but the code will not build in my Azure pipeline. The build error message suggests my Azure build agent is using a different version of C#. How do I check to see what version it's using?
In the log of visual studio build task, you can search csc.exe, then you could find the path of csc.exe. Then you could check language version by calling csc.exe -langversion:?
VS2019 : C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Roslyn
Regarding specify the hosted agent dynamic, you could use parameters in YAML pipeline, then you could choose the image in Run pipeline form:
For example:
parameters:
- name: image
displayName: Pool Image
type: string
default: windows-latest
values:
- windows-latest
- vs2017-win2016
- ubuntu-latest
- ubuntu-16.04
- macOS-latest
- macOS-10.14
trigger:
- none
jobs:
- job: myjob
pool:
vmImage: ${{ parameters.image }}
steps:
- task: CmdLine@2
inputs:
script: '.\csc.exe -langversion:?'
workingDirectory: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Roslyn'
To check installed software on your build agent from azure devops go to:
Settings > Agent pools > buid-agents > build-agent-0-1
and go to Capabilities
tab
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With