Unable to load DLL 'Microsoft.Data.SqlClient.SNI.x86.dll':
Hi,
Have a .NET framework (4.8 ) console application that uses SQL 2022 via the nuget packages Microsoft.Data.SqlClient and .SqlClient.SNI. The app is built into an executable via a stetup/installer project (https://marketplace.visualstudio.com/items?itemName=VisualStudioClient.MicrosoftVisualStudio2022InstallerProjects)
When I debug my project all works as expected, however when I build the EXE and run it from the command like I get this error
Unhandled Exception: System.TypeInitializationException: The type initializer for 'Microsoft.Data.SqlClient.TdsParser' threw an exception. ---> System.TypeInitializationException: The type initializer for 'Microsoft.Data.SqlClient.SNILoadHandle' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'Microsoft.Data.SqlClient.SNI.x86.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
I used to use System.Data.SqlClient but switched Microsoft.Data.SqlClient for this new project.
Do I need to reference Microsoft.Data.SqlClient in my setup project?
Thanks