MaFi-Games / Captain-of-industry-modding

Official modding resource for video game Captain of Industry.
https://www.captain-of-industry.com
MIT License
41 stars 40 forks source link

.csproj have no explicit language version declaration #11

Open MaciejPolanski opened 2 months ago

MaciejPolanski commented 2 months ago

.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.

Matzu89 commented 4 weeks ago

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 commented 4 weeks ago

image