.NET Framework 引用 .NET Standard类库时致出现:未能加载文件或程序集的异常

.NET Framework 引用 .NET Standard类库时致出现System.IO.FileNotFoundException: 未能加载文件或程序集 的异常

问题描述

.NET Framework 引用 .NET Standard类库时,依赖项不能从standard流向framework导致出现 System.IO.FileNotFoundException: 未能加载文件或程序集 的异常

解决方案:

在 .net framework项目的工程文件(csproj)中配置:

<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

发布了110 篇原创文章 · 获赞 36 · 访问量 31万+

猜你喜欢

转载自blog.csdn.net/zhaobw831/article/details/102680159