带有SqlClient的System.IO.FileNotFoundException [英] System.IO.FileNotFoundException with SqlClient

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

问题描述

在按照此处所述解决问题后我收到以下异常

After fixing my problem as mentioned here I am getting the below exception


System.IO.FileNotFoundException:'无法加载文件或程序集'System.Data.SqlClient,Version = 4.1.0.0,文化=中性,PublicKeyToken = b03f5f7f11d50a3a'或其依赖项之一。系统找不到指定的文件。'

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

我的库是.NET Standard 1.4,而WebApp是.NET Framework 4.6.1。

My library is a .NET Standard 1.4 and the WebApp is .NET Framework 4.6.1

System.Data.SqlClient版本-4.3.0 NuGet软件包。
因此,我尝试执行以下操作,但没有成功:

System.Data.SqlClient is version - 4.3.0 NuGet package. So I tried doing the below but in vain:

<dependentAssembly>
      <assemblyIdentity name="System.Data.SqlClient" culture="neutral" publicKeyToken="31bf3856ad364e35"/>
      <bindingRedirect oldVersion="4.1.0.0" newVersion="4.3.0.0"/>
</dependentAssembly>


推荐答案

我想您可能已经知道了,但是希望这样可以节省一些宝贵的时间

I guess you may have figured it out already but hope it would save someone precious time

为了使所有工作正常运行,您需要在WebApp .NET Framework 4.6中引用 System.Data.SqlClient 引用您的.NET标准库的.1项目。之后,一切都应该正常工作。

In order to make everything work you would need to reference System.Data.SqlClient in WebApp .NET Framework 4.6.1 project that is referencing your .NET Standard Library. After that everything should work just fine.

.NET标准库之类的声音还没有完全依赖于依赖库的二进制文件。 .NET Standard引用中没有类似于复制本地选项的内容,因此我也看不到任何检查或设置此行为的方法

Sounds like .NET Standard Library haven't grabbed with itself dependent library binary. There is nothing like "Copy Local" option in .NET Standard references so I don't see any way to check or set this behavior too

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

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