MaFi-Games / Captain-of-industry-modding

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

.csproj have no explicit language version declaration #11

Open MaciejPolanski opened 4 weeks ago

MaciejPolanski commented 4 weeks 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.