将文件引用添加到 .net Core 项目会导致程序集未找到异常

Adding a File Refrence to a .net Core Project results in assembly not found exception

创建 .net 核心项目 1.1 后,我添加了对 .net 标准库程序集的文件引用。

启动解决方案时,出现程序集未找到异常

.net 核心目前不支持添加文件引用 1.X。 也许在 2.0 中看到:https://github.com/dotnet/coreclr/issues/10037#issuecomment-285394031 and https://github.com/dotnet/sdk/issues/120

the .NET Core SDK v1.0 (Visual Studio 2017 RTM) doesn't support direct references to assemblies on disk. Basically the options that will give you success are either or .

We did enable this scenario for 2.0 though. See dotnet/sdk#120, but those bits have not been released yet. They will be when .NET Core 2.0 comes out later this year.

您有以下解决方法

解决方法

  • 将程序集打包到 nuget 包中
  • 尽可能使用项目引用