Skip to content

F# Project Reference issue on netcore 2.0 #8410

Description

@ncave

The following F# project works fine when TargetFramework is netstandard1.6 / netcoreapp1.0
but fails with netstandard2.0 / netcoreapp2.0 (but same project works on 2.0 if --language is C#).

Steps to reproduce

/test/lib/lib.fsproj:

<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Remove="**/*.fs" />
<Compile Include="Library.fs" />
</ItemGroup>
</Project>

/test/app/app.fsproj:

<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="../lib/lib.fsproj" />
</ItemGroup>
<ItemGroup>
<Compile Remove="**/*.fs" />
<Compile Include="Program.fs" />
</ItemGroup>
</Project>

/test/lib/Library.fs:

namespace Lib
module Say =
let hello name = printfn "Hello World from %s!" name

/test/app/Program.fs:

[<EntryPoint>]
let main argv =
Lib.Say.hello "F#"
0

Expected behavior

Hello World from F#!

Actual behavior

Unhandled Exception: System.MissingMethodException: Method not found: 'Void Lib.Say.hello(System.String)'.
at Program.main(String[] argv)

Environment data

dotnet --info output:

.NET Command Line Tools (2.1.0-preview1-006474)
Product Information:
Version: 2.1.0-preview1-006474
Commit SHA-1 hash: e3d388e82d
Runtime Environment:
OS Name: Windows
OS Version: 10.0.14393
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\2.1.0-preview1-006474\
Microsoft .NET Core Shared Framework Host
Version : 2.0.0-preview2-25407-01
Build : 40c565230930ead58a50719c0ec799df77bddee9

Metadata

Metadata

Assignees

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