Fable: incorrect Fable.Compiler.runtimeconfig.json generated during NPM install

Created on 27 Mar 2019  路  7Comments  路  Source: fable-compiler/Fable

Description

dotnet --info
.NET Core SDK (reflecting any global.json):
 Version:   2.2.105
 Commit:    7cecb35b92

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  18.04
 OS Platform: Linux
 RID:         ubuntu.18.04-x64
 Base Path:   /usr/share/dotnet/sdk/2.2.105/

Host (useful for support):
  Version: 2.2.3
  Commit:  6b8ad509b6

.NET Core SDKs installed:
  2.1.403 [/usr/share/dotnet/sdk]
  2.2.105 [/usr/share/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.5 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.2.3 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.5 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.2.3 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.5 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.2.3 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

Upon trying to run this project I was faced with the error message:

fable-compiler 2.1.12 ERROR: Could not load file or assembly 'System.ComponentModel, Version=4.0.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

The original Fable.Compiler.runtimeconfig.json was generated like this:

{
  "runtimeOptions": {
    "tfm": "netcoreapp2.1",
    "framework": {
      "name": "Microsoft.NETCore.App",
      "version": "2.1.0"
    }
  }
}

After a lot of aimless tries and head-scratching, I was able to find the solution in this article. Manually changing the file to:

{
  "runtimeOptions": {
    "framework": {
      "name": "Microsoft.NETCore.App",
      "version": "2.2.3" <----- Microsoft.NETCore.App 2.2.3
    }
  }
}

I'm not familiar with .NET, but even so, the error message was unhelpful. I was only able eventually make it run out of curiosity and persistence, by peeking inside of the package's files.

Related information

  • Fable version: fable-compiler 2.1.12

Most helpful comment

Not an issue anymore! I'll close it @alfonsogarciacaro

All 7 comments

Why I hate dotnet, reason 324 ;)

I should have foreseen this coming. Fable is currently targeting netcoreapp2.1 and I guess you don't have it installed in your machine. Could you please run dotnet --list-runtimes and paste the result?

I guess we should make sure the proper dotnet runtime is installed before trying to run Fable. Obviously, dotnet itself cannot make this check for us instead of throwing an obscure error, that would remove out all the fun 馃槵

This _should_ work if I read the documentation right: https://docs.microsoft.com/en-us/dotnet/core/whats-new/dotnet-core-2-1#roll-forward

All .NET Core applications starting with .NET Core 2.0 automatically roll forward to the latest minor version installed on a system.

Starting with .NET Core 2.0, if the version of .NET Core that an application was built with is not present at runtime, the application automatically runs against the latest installed minor version of .NET Core. In other words, if an application is built with .NET Core 2.0, and .NET Core 2.0 is not present on the host system but .NET Core 2.1 is, the application runs with .NET Core 2.1.


You have 2.1.5 installed, fable specifies 2.1.0, so it should roll-forward to 2.1.5.

@alfonsogarciacaro

dotnet --list-runtimes
Microsoft.AspNetCore.All 2.1.5 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.3 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.5 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.3 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.5 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.3 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

Fable is currently targeting netcoreapp2.1

Then it would be helpful to have this information available upfront for newcomers, as well as install instructions for selecting the right version (README link redirects to https://dotnet.microsoft.com/download which is 2.2).

@0x53A
I initially had only dotnet-sdk-2.1.300-preview2-008533 installed (which is 2.1.403) and it wasn't "rolling-forward". I only upgraded to 2.2 in the first place because I was hoping that the error would go away.

@reaysawa TBH everything is very confusing for me too. I didn't know about this runtimeconfig.json file and I never get to understand the rules wherein dotnet decide which runtime should run which app.

I just removed all dotnet sdks and runtimes from my machine, installed the latest one (runtime 2.2.3) and could run latest fable-compiler (2.2.0) without issue, so rolling forward worked in my case 馃槙

@alfonsogarciacaro the repository I linked in the first post seems to be using another version of the compiler -> 2.1.12
also see: paket dependencies

In my case I had 2.1.5 installed but it didn't roll, hence the error

Sorry @reaysawa but I'm still not able to reproduce this. Is it still an issue for you? Can it be closed?

Not an issue anymore! I'll close it @alfonsogarciacaro

Was this page helpful?
0 / 5 - 0 ratings

Related issues

stkb picture stkb  路  3Comments

et1975 picture et1975  路  3Comments

alfonsogarciacaro picture alfonsogarciacaro  路  3Comments

krauthaufen picture krauthaufen  路  3Comments

nozzlegear picture nozzlegear  路  3Comments