When creating a new Visual Studio solution, I would like to use Directory.Build.props to control the c# version number for all c# projects without having to set them individually.
However, having a mix of c# and f# folders causes a compilation error.
Severity Code Description Project File Line Suppression State
Error FS0246 Unrecognized value '8.0' for --langversion use --langversion:? for complete list FSharpLib C:\source\solution\FSharpLib\FSC 1 Active
This is the smallest solution to demonstrate the issue. In a real solution there is obviously more projects.
Folder Structure
\solution
\solution\Directory.Build.props
\solution\CSharpLib
\solution\FSharpLib
Directory.Build.props
<Project>
<PropertyGroup>
<LangVersion>8.0</LangVersion>
</PropertyGroup>
</Project>
Project Files (for completeness)
CSharpLib<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
</Project>
FSharpLib
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include="Library.fs" />
</ItemGroup>
</Project>
Is it possible to have c sharp and f sharp projects side by side with a Directory.Build.props in the root folder to only apply to c sharp projects?
Moving the build props to a folder with only csharp projects beneath would work but I don't want to structure things this way - I want related modules alongside each other.