Skip to content

TreatWarningsAsErrors does not treat warnings as errors #2521

@Wallace-Kelly

Description

@Wallace-Kelly

Description

When the property <TreatWarningsAsErrors>true</TreatWarningsAsErrors> is included in the fsproj file, the Fable compiler still issues warnings instead of errors.

Repro code

Test.fsproj

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>net5.0</TargetFramework>
    <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
  </PropertyGroup>

  <ItemGroup>
    <Compile Include="Library.fs" />
  </ItemGroup>

</Project>

Library.fs

module WarnAsErrorTest

type Message = Load | Save | Exit

let message =
    function
    | Load -> printfn "Loading"
    | Save -> printfn "Saving"

Expected and actual results

Expected

Running dotnet fable should print an error message.

Actual

Running dotnet build does print an error message.

Running dotnet fable does not print an error message.

Related information

  • Fable version: dotnet fable --version : 3.2.12
  • Operating system: Windows

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions