Captain-of-industry-modding icon indicating copy to clipboard operation
Captain-of-industry-modding copied to clipboard

.csproj have no explicit language version declaration

Open MaciejPolanski opened this issue 1 year ago • 3 comments

.csproj have no explicit language version declaration, which can lead to hard to understand magic bugs like #9.

The error I got was: source\repos\Captain-of-industry-modding\src\ExampleMod\ExampleMachineData.cs(7,1,7,10): error CS8370: Feature 'file-scoped namespace' is not available in C# 7.3. Please use language version 10.0 or greater.

After quite a long investigation - first time working with C# - I found out that for some magical reason language version is fixed to 7.3 According to StackOverflow this may magically happen, if version is not declared at all.

Solution can be to set it e.g. to latest: <LangVersion>Latest</LangVersion>

Hovever, more professional would be to set it to exact version you decided to use for CoI.

MaciejPolanski avatar Aug 22 '24 02:08 MaciejPolanski

Omg thank you !!!

Can you maybe change title to file-scoped namespace - I looked over this one at first glance..

Feels kind of scary indeed to just assume the latest language features are supported, but will do for now.

Matzu89 avatar Oct 15 '24 16:10 Matzu89

image

Matzu89 avatar Oct 15 '24 16:10 Matzu89

I can’t find where to make the modifications, an example or a copy would be appreciated

thank you

littleroad666 avatar Jan 25 '25 15:01 littleroad666