问题描述

创建.net framework项目、.net standard项目(我还在.net standard项目中引用了nuget包)。在.net framework项目种引用.net standard项目后,执行调试,提示找不到引用的nuget包。

解决方案

在 .net framework项目的工程文件(csproj)中配置(添加到<PropertyGroup>节点中):

<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>

参考

[Referencing a .net standard class library project in .net Framework web app and System.IO.FileNotFoundException throws]

[Dependencies don’t flow from new NETStandard project to old Desktop projects through ProjectReferences]