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?
@gabomgp Can you share your omnisharp log?
@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 Thanks you very much. You resolved my question.
Most helpful comment
@gabomgp by default OmniSharp assumes
net46mode 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. fromC:\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.