Closed shaggygi closed 6 years ago
To access a dotnet standard dll, you need to reference netstandard library in main (host) application. So you need to pass this assembly to Roslyn while compiling your code.
I tried this with VS 15.4 RTM and appears to now work in C# Interactive. I can close out unless there is something else being investigated here.
I'm using VS 2017 15.5.0 and experience the same issue. When I right-click on a “.NET Standard 2.0 library” project, the “Initialize C# Interactive with Project” doesn't appear and when I reference it with #r
I get Could not load file or assembly...
.
Same here, i used VS 15.5.2.
A walkaround is to double-build the project – once for production, targetting .NET Standard, and the other time for Interactive, targetting a specific .NET Framework. Then you can load the built dlls using the #r
directive. But it's so annoying that most of the time it's not worth it and it's better to copy-paste the code right into the Interactive console 😕 Not a great victory for .NET Standard and fast prototyping.
When I right-click on a “.NET Standard 2.0 library” project, the “Initialize C# Interactive with Project” doesn't appear
The new project system doesn't support this command yet. It does not matter whether the library targets .NET Standard (<TargetFramework>netstandard20</TargetFramework>
) or .NET Framework (<TargetFramework>net46</TargetFramework>
).
when I reference it with #r I get Could not load file or assembly...
I do not have a problem referencing netstandard2.0 library "manually" in VS 2017 Update 6 Preview 6 like so:
Can anyone share a library (.dll) that demonstrates the problem?
This still appears to be working for me in 15.7.5, so I'm closing.
@m93a The "Initialize Interactive with Project" is being tracked here #26934.
Version Used: VS 2017.3 RTM
Steps to Reproduce:
Expected Behavior: Should be able to use Interactive with the DLL.
Actual Behavior: Get the following error: