.Net Core 2 supports a direct reference to external
.dll (e.g. Net Standard libraries, classic .Net Framework libraries). You can do it through Visual Studio UI: right click on
Dependencies->Add reference->Browse and select your external
Alternatively, you can edit
<ItemGroup> <Reference Include="MyAssembly"> <HintPath>path\to\MyAssembly.dll</HintPath> </Reference> </ItemGroup>
You can face with the following error:
Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly
then just remove
\bin folder an rebuild the project. It should fix the issue.
How it is possible
Net Core 2.0 supports
.Net Standard 2.0.
Net Standard 2.0 provides a compatibility mode to connect
.Net Core(.Net Standard) and
.NET Framework. It can redirect references e.g. to
mscorlib.dll(Net. Framework) to
System.Runtime.dll(Net. Core). But even if your net core app is successfully compiled with dependency on external
dll you may still have issues with compatibility during runtime if there is any API used by external library which .Net Standard doesn’t have.