Safer F#/.NET environments

I always find it amazingly hard to tweak .NET project’s tooling outside Visual Studio or Rider. The solution (.sln) file is just a cryptic list of GUIDs, project files (.[fc]proj) have no autocompletion on its options through LSPs and there’s nothing fancy on fsharp-mode nor VSCode Extensions to help you. For this reason I want to show here some files and options I use to make my F#/C# projects safer and easier to use.

According to the documentation, Directory.Build.props is a file that you can put at the root of your directory to define default properties to all of your project at once. In my case, I use it with the following properties:

<Project>
  <PropertyGroup>
    <Deterministic>true</Deterministic>
    <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
    <MSBuildTreatWarningsAsErrors>true</MSBuildTreatWarningsAsErrors>
  </PropertyGroup>
</Project>