Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# language versioning when automatically selected based on framework version

I have to update the C# version. Now, I use version 7.3 but I need to use 8 or greater version.

While applying the steps in this link, I faced with the problem as it can be seen in the image.

enter image description here

How can I solve this problem? Is there any way to make it manual instead of automatic?

like image 294
Nihad Huseynov Avatar asked Mar 16 '26 20:03

Nihad Huseynov


1 Answers

If you edit your .csproj add this line inside the first <PropertyGroup>

<LangVersion>latest</LangVersion>

or if you want to specify the version

<LangVersion>8.0</LangVersion>

In other words:

  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{68EAC5EC-1EE6-4B41-BCF8-ED62CA1B6364}</ProjectGuid>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>SqlServerCLRFunctions</RootNamespace>
    <AssemblyName>SqlServerCLRFunctions</AssemblyName>
    <TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
    <FileAlignment>512</FileAlignment>
    <Deterministic>true</Deterministic>
    <LangVersion>8.0</LangVersion> <!-- added, default is C# 7.3 -->
  </PropertyGroup>
like image 110
SuperTx2 Avatar answered Mar 18 '26 10:03

SuperTx2



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!