You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the project is built in windows 11 using visual studio v17.9.2 , it is compiled without errors.
Note: visual studio 2022 v 17.9.2 auto install net8 (that support c# 12). So it is expected to success compilation
When the project is built in In Ubuntu 22.04 (with Mono 6 installed), using the command dotnet build , the compiler raise error:
CSC : error CS1617: Invalid option '12' for /langversion. Use '/langversion:?' to list supported values.
Resolving the issue:
I had to install net8 sdk (8.0.200) with runtime in Ubuntu 22.04 to build the project and modify the global.json.
Then rebuild. The build success without errors:
It seems that c# 12 support need net8 to be installed in UbUntu 22.04. (or windows)
I suggest, this limitation can be documented.
The text was updated successfully, but these errors were encountered:
moh-hassan
changed the title
C# 12 need net8 sdk to be installed in Ubuntu 22.04, but success in Windows.
C# 12 need net8 sdk to be installed in Ubuntu 22.04, but success in Windows using visual studio 2022.
Mar 6, 2024
This issue raised an important point for supporting c# features for old framework: The dotnet SDK version that support the c# langVer in csproj file should be installed
When using Visual studio 2022, there are typically more copies of compilers are installed:
One is at C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\Roslyn.
This copy is used by Visual Studio, and contains .NET Framework entry points.
In every vs2022 , the corresponding dotnet SDK is auto installed (in my case net8 with c# 12 support.
The other one (for net6) is at C:\Program Files\dotnet\sdk\6.0.400\Roslyn\bincore.
This one is used from command line. It contains .NET Core entry points. When executing, it's actually doing dotnet.exe csc.dll.
This compilere support at max c# 10
The third one (for net8) is at C:\Program Files\dotnet\sdk\8.0.200\Roslyn\bincore.
This compilere support at max c# 12
We can find by command:
A multi target project net6, net472 with c# 12 is developed to support both windows and Linux.
<LangVersion>12</LangVersion>
i use global.json that allow sdk6:
When the project is built in windows 11 using
visual studio v17.9.2
, it is compiled without errors.When the project is built in In Ubuntu 22.04 (with Mono 6 installed), using the command
dotnet build
, the compiler raise error:Resolving the issue:
I had to install net8 sdk (8.0.200) with runtime in Ubuntu 22.04 to build the project and modify the
global.json
.Then rebuild. The build success without errors:
It seems that c# 12 support need net8 to be installed in UbUntu 22.04. (or windows)
I suggest, this limitation can be documented.
The text was updated successfully, but these errors were encountered: