When building on vsts (windows hosted machine) I have the following error:
Operator '==' cannot be applied to operand 'default'
However, in my project I have:
<PropertyGroup>
<LangVersion>7.1</LangVersion>
</PropertyGroup>
Moreover, on my machine it does build (in Debug AND Release modes).
UPDATE
The error first appeared while I had the following:
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<LangVersion>7.1</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<LangVersion>7.1</LangVersion>
</PropertyGroup>
Note that this is a library and that I do multi-targeting (netstandard2.0;xamarinios10
) but I don't see why it should matter.
UPDATE2
I tried
<PropertyGroup>
<LangVersion>7.1</LangVersion>
</PropertyGroup>
Looking in the logs I see:
/reference:/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/Xamarin.iOS/Facades/System.Xml.Xsl.Primitives.dll /debug- /debug:portable /filealign:512 /nologo /optimize+ /out:obj/Release/xamarinios10/MyApp.ViewModels.dll /target:library /warnaserror- /utf8output /deterministic+ /langversion:latest /analyzer:/Users/vsts/.nuget/packages/uno.ui/1.31.0-dev.8/analyzers/Uno.Analyzers.dll MyViewModelA.cs MyViewModelB.cs... Parameter.cs ReactiveGroup.cs "/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/Xamarin.iOS,Version=v1.0.AssemblyAttributes.cs" obj/Release/xamarinios10/MyApp.ViewModels.AssemblyInfo.cs /warnaserror+:NU1605
2018-06-27T20:11:28.5184750Z MyViewModelA.cs(105,89): error CS8310: Operator '==' cannot be applied to operand 'default' [/Users/vsts/agent/2.134.2/work/1/s/MyApp.ViewModels/MyApp.ViewModels.csproj]
So I think it may not be a build error but some kind of Uno Analyser error.
Side note: it is strange that the log mentions uno.ui/1.31.0-dev.8
as I had upgraded the package (see below). As if there were some caching involved I don't know how.
<PackageReference Include="Uno.UI" Version="1.31.0-dev.79" />
UPDATE3
I can't copy the full log here but here the csc
command for the project that fails to build:
/Library/Frameworks/Mono.framework/Versions/5.8.1/lib/mono/4.5/csc.exe /noconfig /unsafe- /checked- /nowarn:1701,1702,1705 /langversion:latest /nostdlib+ /errorreport:prompt /warn:4 /define:__IOS__;__MOBILE__;__UNIFIED__;TRACE;RELEASE;XAMARINIOS1_0
UPDATE4
Thanks to @JeromeLaban, who provided me with that link about Mono 5.8.0, as it shows that version of mono is compatible with C# 7.0 only.
However, the specs of the MacOs queue say that there is Mono 5.10 installed and that version is up to C# 7.2. So the next question (and I wrote a dedicated question) is how to specify the mono version to build with.
The xamarinios vsts task that I run on the hosted vsts MacOs queue runs mono 5.8.0 (even though mono 5.10.0 is installed on that queue as per specs). And version 5.8.0 is compatible up to C# 7.0 so it cannot run C# 7.1 code.