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

In csharp script using .netstandard library: The type 'List<>' is defined in an assembly that is not referenced. #996

Closed
gabomgp opened this issue Oct 26, 2017 · 3 comments
Labels

Comments

@gabomgp
Copy link

gabomgp commented Oct 26, 2017

I'm using a script referencing a assembly compiled with .net standard 2. When i use a property of type List'1, I'm getting the error in vscode:

The type 'List<>' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. [testValidation.csx]

Is possible to reference a assembly compiled with .net standard 2 from a csx file, and that the intellisense works properly in vscode?

@rchande
Copy link

rchande commented Oct 31, 2017

@gabomgp Can you share your omnisharp log?

@filipw
Copy link
Member

filipw commented Oct 31, 2017

@gabomgp by default OmniSharp assumes net46 mode for resolving script dependencies. You can add #! "netcoreapp2.0" directive at the top of your script to force the assembly resolution to assume .NET Core 2.0 mode.

The alternative is to manually reference netstandard.dll (which is only used for type forwarding) i.e. from C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.0. At the end of the day, it also depends how you will run your script (with which script runner), and whether it's able to understand NET Standard 2.0.

@filipw filipw added the csx label Oct 31, 2017
@gabomgp
Copy link
Author

gabomgp commented Nov 10, 2017

@filipw Thanks you very much. You resolved my question.

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

3 participants