I would like to use interpolated strings in this old WCF project, and I have tried to change the target framework to .NET Framework 4.8 (from project pages). But this does not seem to change the C# version from 5 to 6.
I'm still getting the error
Feature 'interpolated strings' is not available in C# 5. Please use language version 6 or greater.
Is this even possible?
CodePudding user response:
You have to update language version in your .csproj file,
<PropertyGroup>
<LangVersion>6</LangVersion>
</PropertyGroup>
When you use language version as a 6, compiler accepts only syntax that is included in C# 6.0 or lower.
If you want to use any features which are included in higher or the latest version of C# like pattern matching, switch expression, global using then you can use latest
instead of 6
.
More details, kindly check C# language version reference
CodePudding user response:
edit the csproj: <LangVersion>6</LangVersion>
(or higher); done