3

I have an UWP app and changed <LangVersion>10</LangVersion> inside .csproj to value 10. Everything works just fine (to my surprise).

But when I tried to build the app inside azure-pipelines it throws this error:

##[error]CSC(0,0): Error CS1617: Invalid option '10' for /langversion. Use '/langversion:?' to list supported values.

What is the last supported version of C# to be used in UWP app? How can I even test the /langversion:? command? (I really don't know where to put it). Why does it works perfectly fine on my local machine, but not inside azure-pipelines?

Target version: 19041, Minimal version: 17763

Alamakanambra
  • 5,845
  • 3
  • 36
  • 43
  • 3
    Try running on the `windows-2022` hosted image with visual studio 2022 as your visual studio version. – jessehouwing Dec 04 '21 at 19:27
  • 2
    Assuming you are using microsoft-hosted build agent, you need the `windows-2022` agent to use `.net 6` and `c# 10`. – YK1 Dec 04 '21 at 19:28
  • 2
    Well, that was it. Thanks. I had `windows-latest` and expecting to be the latest. That is a mystery to me - why the `windows-latest` is not pointing to 2022? – Alamakanambra Dec 04 '21 at 20:13

0 Answers0