C# LangVersion preview not working (C# 13 / 14)

On Linux, I have a .NET 8 project with <LangVersion> preview in the csproj, which should get me C# 14 features. However, Rider is flagging the use of the “field” keyword in a property getter / setter (Cannot resolve symbol “field”) and the use of an initializer with non-default getter / setters (Only auto-properties and properties with backing fields can have an initializer).

This is the project file:

https://github.com/MV10/eyecandy/blob/master/eyecandy/eyecandy.csproj#L24

…and this is the property it doesn't like:

https://github.com/MV10/eyecandy/blob/master/eyecandy/Utils/ErrorLogging.cs#L20

The code was originally written in VS2022 on Windows, but for Rider I am on v2025.2.3 in Debian 13.

0
4 comments

Hello, 

Thanks for contacting JetBrains support. 

Regarding this issue, it requires dotnet 10 installed and you need to specify msbuild of dotnet 10 in Rider. Please go to Rider Settings | Build, Execution, Deployment | Toolset and Build, and set “MSBuild version” and “.NET CLI executable path” accordingly:

Please let me know if you have any questions. 

Regards,

Tom

 

0

Thanks. I suppose it worked on Windows in VS because that side has .NET 9 installed (though not in use). 

I had mistakenly thought I only had .NET 8 installed there.

0

mcguirev10 On Linux, dotnet 10 can be installed via install script. Here're the steps that work for me:

1. Download script: wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh

2. Grant permission: chmod +x ./dotnet-install.sh

3. Install dotnet 10:./dotnet-install.sh --channel 10.0.1xx 

Reference

Install .NET on Linux without using a package manager - .NET | Microsoft Learn

core/release-notes/10.0/install.md at main · dotnet/core · GitHub

0

Please sign in to leave a comment.