Netstandard依赖项System.IO.FileNotFoundException [英] Netstandard dependency System.IO.FileNotFoundException

查看:319
本文介绍了Netstandard依赖项System.IO.FileNotFoundException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个.Net Framework 4.7应用程序,该应用程序依赖于该解决方案中针对.NET Standard 2.0的另一个项目.

该项目再次依赖于另一个(外部).NET Standard 2.0库,该库已通过私有Nuget存储库添加.该库依赖Microsoft.Win32进行注册表查找.

调试.Net FW应用程序时,在运行时会收到FileNotFoundException:

System.IO.FileNotFoundException: 'Could not load file or assembly 'Microsoft.Win32.Registry, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.'

我更改了使用注册表的库,并添加了Microsoft.Win32.Registry包. 再次调试时,错误然后更改为其他版本:

Could not load file or assembly 'Microsoft.Win32.Registry, Version=4.1.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

我们在哪里努力解决这个问题?使用Win32.Registry的库中是否配置错误?还是取决于它的.NET Standard项目?还是在.NET 4.7应用程序的顶层?

解决方案

对于发现该线程的任何人,有效的方法是将外部库使用的win32.registry nuget包也添加到.net Framework 4.7项目中./p>

甚至认为这远非理想,这是在这种情况下唯一有效的方法,必须这样做.

参考: 解决方案

For anyone finding the thread, what worked was to add the win32.registry nuget package used by the external library to the .net framework 4.7 project as well.

Even thought this feels far from optimal, it was the only thing that worked in this case, and it'll have to do.

Ref: Why is my .NET framework app looking for the wrong version of the .NET core/standard platform extension assembly, and how do I fix it?

这篇关于Netstandard依赖项System.IO.FileNotFoundException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆