question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

F# Project Reference issue on netcore 2.0

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
enricosadacommented, Jun 17, 2017

@ncave i converted your minimal repro in a test case https://github.com/dotnet/cli/pull/6914

0reactions
ncavecommented, Jun 20, 2017

@livarcocc @cartermp Just tested with 2.0.0-preview2-006494, it’s fixed by dotnet/cli#6937. Closing.

Read more comments on GitHub >

github_iconTop Results From Across the Web

NET Core 2.0 Project Builds But Not When Referenced By ...
After deleting the bin and obj folders from the project directory and rebuilding, a different error was being displayed.
Read more >
NET Core 2.0.0 Known Issues
NET Core 2.0.0 Known Issues. This document lists known issues for .NET Core 2.0.0 and .NET Core SDK 2.0.0 which may be encountered...
Read more >
MSB3644: The reference assemblies for 'version' were not ...
This error occurs when the .NET reference assemblies aren't found for the version of .NET that a project requests. Check that your project ......
Read more >
Multi-Targeting and Porting a .NET Library to .NET Core 2.0
NET Core only shows the two packages (Json.net and SqlClient) I pulled in, while .NET 4.5 shows the specific assembly reference - both...
Read more >
Multi-targetting .Net Framework and .Net Core in a single project
A 15-second guide and 15-minute walk through. You have a .Net Core project, whether a netstandard library, or a netcore app, and you'd...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found