Skip to content

[Sdk 2] Compiler does not fail if FSharp.Core is not referenced #3340

@0x53A

Description

@0x53A

Note: No paket this time, really just these two files. =)

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

  <PropertyGroup>
    <TargetFramework>net461</TargetFramework>
    <DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
  </PropertyGroup>
  
  <ItemGroup>
    <Compile Include="Library.fs" />
  </ItemGroup>
  
</Project>
namespace fsharp_test

module Say =
    let hello name =
        let r = Result.Ok name
        printfn "Hello %s" (match r with Ok n -> n | Error x -> x)

Expected

I would expect the project to fail with an actionable error message.

Actual

image

image

Note how the generated package does not have a reference against FSharp.Core!

The compiler (not the SDK!) just picked any available FSharp.Core from the environment.

This will cause lot's of issues at runtime.

/cc @forki, ref fsprojects/Paket#2528 (comment)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions