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

how to add framework reference? #861

Open
Spongman opened this issue Nov 2, 2020 · 6 comments
Open

how to add framework reference? #861

Spongman opened this issue Nov 2, 2020 · 6 comments
Labels
Area-Packages and Extensions Related to acquiring and using packages and extensions Impact-Low

Comments

@Spongman
Copy link

Spongman commented Nov 2, 2020

how do you add a framework reference, similar to the following .csproj line:

    <FrameworkReference Include="Microsoft.AspNetCore.App" />

?

The following code block

void F(Microsoft.AspNetCore.SignalR.Hub h) {}

Gives the following error:

The type or namespace name 'Hub' does not exist in the namespace 'Microsoft.AspNetCore.SignalR' (are you missing an assembly reference?)

With .csproj you don't need an assembly reference, the above FrameworkReference element includes the SignalR dlls.

@jonsequitur
Copy link
Contributor

This isn't currently supported but you should be able to reference the package directly using #r nuget.

@dsyme
Copy link
Contributor

dsyme commented Dec 4, 2020

See also dotnet/fsharp#8688

@jonsequitur
Copy link
Contributor

Also possibly related: #890

@fwaris
Copy link

fwaris commented Jun 1, 2021

This is starting to affect my current work. Mostly I need to perform visualizations on data, e.g. MSAGL graph viewer that requires Windows Forms.

Priority will be appreciated.

Faisal

@jkone27
Copy link

jkone27 commented Jan 24, 2022

Any updates around framework reference, isn't this useful also for aspnetcore apps? cheers

@nycdotnet
Copy link
Contributor

It seems like this does work now, but it's not documented here.

Example: create a brand new notebook, with a C# block with the following content only:

using System.Net.Http.Json;

When you run it, it will return:

Error: (1,23): error CS0234: The type or namespace name 'Json' does not exist in the namespace 'System.Net.Http' (are you missing an assembly reference?)

If you change the code to:

#r "System.Net.Http.Json.dll"
using System.Net.Http.Json;

It will work. This should be improved in the docs for #r in my opinion (and ideally there should be some sort of suggestion to import the corresponding system DLL like VS and Rider do).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Packages and Extensions Related to acquiring and using packages and extensions Impact-Low
Projects
None yet
Development

No branches or pull requests

7 participants