-
Notifications
You must be signed in to change notification settings - Fork 285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to load DLL 'Microsoft.Data.SqlClient.SNI.x86.dll' #727
Comments
Reference the MDS package directly in the .exe projects. |
Hi @jonathan-timothy-mason , as what @ErikEJ suggested, you need reference the Microsoft.Data.SqlClient nuget package directly in your executable project so the nuget manager is able to copy SNI dlls to the target bin folder. Please feel free to try it and see whether it works. And one more thing to check, what type is the .NET framework project you are working on? Is it a WebForms project or just a common .NET Framework project? We have some known issues about WebForms project #446 . |
Thanks for your replies @ErikEJ and @karinazhou. To sum up, anything with a dependency on a project using Microsoft.Data.SQLClient doesn't get Microsoft.Data.SqlClient.SNI.xxx.dll copied to it's bin folder. Is that right? Do you think unit test projects that have a dependency on our database project would also need to be made to directly reference Microsoft.Data.SQLClient too? Thanks a lot. |
No, that is not right. This works as expected in most scenarios, so please provide a repro solution. |
Our projects typically reference our data access project, which itself directly references Microsoft.Data.SQLClient. I've included a document, which lists all our top-level projects, and says which experience the "Unable to load DLL 'Microsoft.Data.SqlClient.SNI.x86.dll'" error. Our solution has 66 projects and I don't think it would be possible to simplify it into a form that I can send to you, which would still accurately reproduce the same problem. Top-Level Projects and “Unable to load DLL 'Microsoft.Data.SqlClient.SNI.x86.dll'” Error.pdf |
Please provide a .csproj file of a failing "top level" project. |
Hi @ErikEJ, attached is the project file for our main Windows Forms project that does not reference Microsoft.Data.SQLClient directly, but does reference the other projects MatrixDAL, MatrixBLL, MatrixBLLBase, MatrixBllDalShared, which do directly reference it directly. |
@jonathan-timothy-mason I looked at the pdf file you attached and all the failing scenarios, except for the VSTest one, can be fixed by directly adding driver's Nuget reference to the top-level project. This is the known issue for native SNI.dll. I think, for now, you may have to directly reference driver nuget in your main project as a workaround. |
OK, thanks for your help @karinazhou, we'll probably wait until it's been fixed to avoid all the unnecessary references. |
As I replied here: #446 (comment) |
I'm facing the same issue but with visio Add-in project!! there is no Bin folder when you publish the add-in |
I tried all these options nothing work for me. I see when i am compiling or publishing the web Application to a folder i see Microsoft.Data.SqlClient.SNI.x86.dll and Microsoft.Data.SqlClient.SNI.x86.pdb inside Bin folder. However when i publish this to Cloud this file i missing. |
@cheenamalhotra any thoughts why my web app is not copying this dll into Bin folder . I explicitly added reference as mention above in .csproj file too. |
If you could upload a repro app, we can take a look and get back to you! |
I have experienced the same issue but with the x64 version. |
Just added a "better" workaround on the other thread #446 (comment) |
I had the same issue and used a post-build event to copy the missing DLL. That worked fine, until Windows file locking put up a roadblock. For reasons unknown, IIS had the file locked. Is there any way to disable Windows file locking entirely or to disable it in certain use-cases? |
We have a similar issue, but on a couple of ASP.NET MVC 5 projects and an ASP.NET Web API 2 project, all targeting net472.
I can see the SNI files copy step in the build log, but the Octopack one after it never copies them over, I imagine because the existence of them is not being passed along to it. I resolved it by explicitly declaring them as files in the nuspec... (Octopack docs). Pretty nasty though.
Aside: Likely a stupid question, but would running |
Hi @benmccallum
|
Thanks for confirming @cheenamalhotra , I figured as much. |
What does SNI stand for ? Can probably put together several repros if I understand what's special about this dll |
To elaborate, https://github.com/dotnet/SqlClient/labels does not even have a description for "Native SNI" It looks like this document explains it: https://docs.microsoft.com/en-us/sql/connect/ado-net/sqlclient-troubleshooting-guide?view=sql-server-ver15
|
SSMS 19.4 have the same problem. 19.3 did not have this problem. |
solved in my case: see below |
same here with SSMS 19 Preview 4 on some servers, not all the servers |
Same here, with ssms 19 preview 4, no connection to any server via IP address. |
@swePeso @brain246 @reinaldokibel @asamaras Could you please provide more info to help us reproduce the issues you're facing with SSMS? Is that something you also reproduce from a .NET Framework Console app with Microsoft.Data.SqlClient? |
@cheenamalhotra Sorry, can't be of any help anymore regarding this issues, as it is now solved on my machine (after de-installing and reinstalling it....). I might have to add that i had several versions of Azure Data Studio (Insiders), VSCode, Visual Studio (2019, 2022) and two instances of SSMS (18 and 19) installed before (yeah, i know... 😄) . After cleaning that mess up and re-installing SSMS19/Preview4 it worked, but in the end i cannot say what did the trick or caused the issue (but maybe that can be a hint for others here...). |
Hi @cheenamalhotra ,
Update: |
@asamaras have you tried using FQDN or server name instead of IP address? This could be due to the new feature HostNameInCertificate |
@JRahnama That indeed could explain it, the server name is set to a local domain but the terminal is not consulting it, I use host file, so there is a possibility that it could not get the certificate from the server. I use IP to connect. |
I went to add/remove programs and ran repair on it, which fixed the problem |
This method had worked with me 👉 if this file "Microsoft.Data.SqlClient.SNI.x86.dll" |
Closing this issue as it appears to be external and has no specific fix to be made in MDS. This is also likely a duplicate of #612 |
Hi,
I have migrated our .NET 4.7.2 x86 solution to Microsoft.Data.SQLClient v2.0.1 using Nuget.
When running our program in Windows 10 64-bit, the error below occurs:
Unable to load DLL 'Microsoft.Data.SqlClient.SNI.x86.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
If I look at the bin folder of our project that deals with the database, which has a dependency on Microsoft.Data.SQLClient, I find:
Microsoft.Data.SqlClient.dll
Microsoft.Data.SqlClient.SNI.x86.dll
Microsoft.Data.SqlClient.SNI.x64.dll
However, if I look at the bin folder of our executable project, which does not have a dependency on Microsoft.Data.SQLClient, but only on our database project, I only find:
Microsoft.Data.SqlClient.dll
If I copy the missing assemblies into the executable bin folder, the problem is solved.
I assume this is a problem with Nuget. What is the best way to solve this without manually copying the missing dependecnies. We have several exeutables.
Upgrading to Nuget 5 didn't help.
Thanks
Jon
The text was updated successfully, but these errors were encountered: