Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add reference to netstandard to prevent issues "You must add a reference to assembly netstandard"? #1938

Closed
matthid opened this issue May 18, 2018 · 11 comments
Labels

Comments

@matthid
Copy link
Member

matthid commented May 18, 2018

Description

image

Expected behavior

Intellisense works.

Actual behavior

See screenshot

Known workarounds

Potentially adding #r "netstandard"

Most portable workaround:

#if !FAKE
  #r "netstandard" // windows
  #r "Facades/netstandard" // mono
#endif
@kblohm
Copy link
Contributor

kblohm commented May 22, 2018

Just an FYI as i have the same problem right now, the workaround for me is

#if !FAKE
  #r "netstandard"
#endif

otherwise i get intellisense but FAKE complains about Multiple references to 'netstandard.dll' are not permitted

@matthid
Copy link
Member Author

matthid commented May 22, 2018

Yes that is the correct workaround I have used as well for the same reason. I guess now that we all have this in place we might as well add it to the intellisense_lazy.fsx file :)

I was a bis hesitant because older editors might choke at that line.

@kblohm
Copy link
Contributor

kblohm commented May 22, 2018

Not sure if this is related, but i tried to use Newtonsoft.Json.Linq and i get:

A reference to the type 'System.Dynamic.IDynamicMetaObjectProvider' in assembly 'System.Core' was found, but the type could not be found in that assembly

Compiles just fine, but intellisense is broken.

@matthid
Copy link
Member Author

matthid commented May 22, 2018

Interesting because I thought we emit framework assemblies into the intellisense file as well. But maybe we just miss them for some reason

@kblohm
Copy link
Contributor

kblohm commented May 22, 2018

Intellisense_lazy.fsx does contain System.Core. A minimal example is working here at home, so it might not be a FAKE problem at all. My computer at work might have some super old .net version installed and #r might just load an old version then.

@matthid
Copy link
Member Author

matthid commented May 22, 2018

Yes only netstandard is missing, correct? Thinking about this maybe this is a paket issue. Question is how do we know that we have to reference netstandard. Probably once we use a netstandard dll paket should have that logic

@kblohm
Copy link
Contributor

kblohm commented May 22, 2018

Yes thats the only one missing. Do you know of a way to deal with #r to load a specific version? You can probably always reference the dll directly. But maybe that problem is so uncommon its not worth doing something about it. Who still has .net 3.5 sdk installed.. :)

@matthid
Copy link
Member Author

matthid commented May 22, 2018

I don't think you can get it running smoothly with .net3.5 :P
But afaik it will always prefer the first referenced version.

@HoraceGonzalez
Copy link
Contributor

Just for the record, referencing the netstandard reference library this way didn't fix the issue for me:

#if !FAKE
  #r "netstandard"
#endif

I had to provide the explicit path to a newer, 4.7.1 facade assembly to get it to work. Eg.

#if !FAKE
#r "/usr/lib/mono/4.7.1-api/Facades/netstandard.dll"
#endif

@csmager
Copy link
Contributor

csmager commented Sep 12, 2018

As I mentioned in ionide/ionide-vscode-fsharp#839 (comment), I think you'll find that this works for mono:

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

@matthid
Copy link
Member Author

matthid commented Jun 10, 2019

I'm addressing this here for Visual Studio Code: ionide/FsAutoComplete#402
I do not plan to address this for Visual Studio, but there is already an issue open

Therefore I'm closing this now. I thought about this several times and there is just no good way to address this in FAKE itself.

@matthid matthid closed this as completed Jun 10, 2019
enricosada pushed a commit to ionide/FsAutoComplete that referenced this issue Jun 13, 2019
Automatically restore and load references via `Fake.Runtime` when opening a script

Add `FAKE` compiler define to shows the correct code-paths

The `netstandard.dll not found` issue went away, because now uses the same command line parameters as the FAKE runtime does (ref dotnet/fsharp#5216 ionide/ionide-vscode-fsharp#839 and fsprojects/FAKE#1938 )
knocte added a commit to nblockchain/geewallet that referenced this issue Dec 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants