Ionide-vscode-fsharp: Intellisense error in `build.fsx` file

Created on 6 Jun 2018  Â·  15Comments  Â·  Source: ionide/ionide-vscode-fsharp

I am not sure if this is something related to Ionide or Fake.

When I open the build.fsx of Thoth I get this following error. And the whole file is red.

The type 'IEquatable`1' is required here and is unavailable. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.

capture d ecran 2018-06-06 a 13 02 16

I am using latest version of Fake 5.0 and already had the problem with 5.0.0-rc018.244

Any ideas what is causing this problem ? And/or how to fix it ?

cc: @matthid

Machine infos

  • Operating system: Darwin
  • Arch: x64
  • VSCode: 1.23.1
  • Runtime: netcore
  • Dotnet version: 2.1.300

Most helpful comment

I did a grep of the mono folder and got two hits:

/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/4.5/Facades/netstandard.dll
/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/4.7.1-api/Facades/netstandard.dll

Rider told me it couldn't find netstandard, but helpfully it showed me where it was searching: in lib/mono/4.5.

This seems to work for me:

#if !FAKE
  #r "Facades/netstandard"
#endif

Is there anything defined for mono so we can get something that works for both?

All 15 comments

Additional info:

I have another project using: Fake 5.0.0-rc016.225 and it's working fine.

Also, even if the intellisense is broken I can run build.fsx and it's working as expected.

See https://github.com/fsharp/FAKE/issues/1938 - workaround is quite simple.
The reason is that intellisense is using "full-framework" and not netcore/netstandard and in the full framework you need the reference.

Why was it working before with 5.0.0-rc016.225 did we had a new deps ?

I think it is because we introduced System.Reactive dependency in Fake.Core.Target

Ok I fixed the intellisense by adding:

#r "paket: groupref netcorebuild //"
#load ".fake/build.fsx/intellisense.fsx"
#if !FAKE
  #r "./packages/netcorebuild/NETStandard.Library.NETFramework/build/net461/lib/netstandard.dll"
#endif

And not just #r netstandard

Interesting because #r "netstandard" should work because it is a framework assembly. Just like #r "System.Anything" works ...

Interesting because if we ever fix this in paket I'm not sure what else then #r "netstandard" we could write.
@MangelMaxime Did you have any errors or was it just ignored? (IE did it hurt to add #r "netstandard"?

Using #r "netstandard just had no effect.

Using both seems to work fine:

#r "paket: groupref netcorebuild //"
#load ".fake/build.fsx/intellisense.fsx"
#if !FAKE
  #r "netstandard"
  #r "./packages/netcorebuild/NETStandard.Library.NETFramework/build/net461/lib/netstandard.dll"
#endif

However, I would prefer that #r "netstandard" works because here I needed to remove storage: none from paket.dependencies :)

@MangelMaxime what .net framework is installed on your system 4.7.2?

@matthid I have no idea.

I guess I have this frameworks installed:

➜  ~ ls $(dirname $(which mono))/../lib/mono/ 
2.0-api                   4.6.1-api                 lldb
3.5-api                   4.6.2-api                 mono-configuration-crypto
4.0                       4.7-api                   monodoc
4.0-api                   4.7.1-api                 msbuild
4.5                       Microsoft F#              nuget
4.5-api                   Microsoft SDKs            xbuild
4.5.1-api                 fsharp                    xbuild-frameworks
4.5.2-api                 gac
4.6-api                   gtk-sharp-2.0
➜  ~ 

Ah, so it might be a mono issue

Related https://github.com/fsharp/FAKE/issues/1985

Is there a final solution/fix?

Using the solution in: https://github.com/ionide/ionide-vscode-fsharp/issues/839#issuecomment-395054266 for now.

But you need to remove storage: none for the netcorebuild
This is needed otherwise people under OSX will have the intellisense problem.

I did a grep of the mono folder and got two hits:

/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/4.5/Facades/netstandard.dll
/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/4.7.1-api/Facades/netstandard.dll

Rider told me it couldn't find netstandard, but helpfully it showed me where it was searching: in lib/mono/4.5.

This seems to work for me:

#if !FAKE
  #r "Facades/netstandard"
#endif

Is there anything defined for mono so we can get something that works for both?

I guess someone should file a mono bug ;)

With FAKE 5.10.1,

#if !FAKE
  #r "Facades/netstandard"
#endif

is the one that works for me, too. Fortunately, that's the one that's set up in the MiniScaffold for library projects, too.

I'm seeing this issue with all the suggested work rounds in place:
OS: Windows
Ionide 4.8.1
f#: Microsoft (R) F# Compiler version 10.7.0.0 for F# 4.7
dotnet sdk: 3.1.100

The header of my file looks like:

#r "paket: groupref build //"
#load "./.fake/build.fsx/intellisense.fsx"

#if !FAKE
#r "netstandard"
#r "Facades/netstandard" // https://github.com/ionide/ionide-vscode-fsharp/issues/839#issuecomment-396296095
#endif

The error message I get is:

A reference to the type 'System.String' in assembly 'netstandard' was found, but the type could not be found in that assembly F# Compiler(1109)

I also get a warning on the first line of the file:

The package management feature requires language version 5.0 use /langversion:preview F# Compiler(3302)

Not sure if this is related.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

draganjovanovic1 picture draganjovanovic1  Â·  3Comments

Agaspher20 picture Agaspher20  Â·  4Comments

landy picture landy  Â·  5Comments

cartermp picture cartermp  Â·  4Comments

isaacabraham picture isaacabraham  Â·  4Comments