A year has passed since the official announcement of C#9, and finally came the moment when we actually decided to update it on our Xamarin project!

This post is not about C#9 features, but about the upgrade process. To learn more about the features, refer to the official announcement:

What’s new in C## 9.0 - C## Guide

Code Update

The first part of the update is to reference C#9 in every project of the solution.

Before starting, make sure you use the latest versions of IDEs, as there was a problem building for C#9 in Rider: https://youtrack.jetbrains.com/issue/RIDER-58915

Then make an update in every .csproj file:

<PropertyGroup>

<LangVersion>9</LangVersion>

</PropertyGroup>

At this moment, everything should be fine: no warnings appeared, the app can be running right from the IDE without any problems.

CI Update

There is no need to update anything in the build process if your CI is working fine after the upgrade.

Let’s say, you noticed that CI fails to build the updated solution, although it can be built locally with the IDE:

Error CS1617 Invalid option ‘9’ for /langversion. Use ‘/langversion:?’ to list supported values.

#ci #dotnet #xamarin #continuous-integration

How to update Xamarin project to C# 9 without CI build failures
1.60 GEEK