I'm using the ArcGIS Pro 2.8 SDK in Visual Studio 2017, and I'm getting the following exception message at runtime:
Unable to load DLL 'Microsoft.Data.SqlClient.SNI.x64.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
To reproduce:
- Create a brand new solution and add-in project according to the tutorial here (call the project and solution "Test").
- Go to Tools-->NuGet Package Manager...-->Manage NuGet Packages for Solution..., and install Microsoft.Data.SqlClient version 3.0.0 into the project, which will add the Microsoft.Data.SqlClient.SNI dependency as well.
- Replace the contents of Button1.cs with the following, and add a real connection string on line 11:
//using System.Data.SqlClient;
using Microsoft.Data.SqlClient; // Added
using ArcGIS.Desktop.Framework.Contracts;
namespace Test
{
internal class Button1 : Button
{
protected override void OnClick()
{
using (var connection = new SqlConnection("ADD CONNECTION STRING TO SQL SERVER HERE"))
{
connection.Open(); // Exception thrown here
}
//string stringURI = ArcGIS.Desktop.Core.Project.Current.URI;
//ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show($"Project path: {stringURI}", "Project Info");
}
}
}4. Run the solution, and you should see the exception on line 13.
I've tried numerous things with no luck, and I made sure Microsoft.Data.SqlClient.SNI.x64.dll was in the build output (though I obviously can't see if it's in the .esriAddinX file). The code works with System.Data.SqlClient, but that package is basically being succeeded by the Microsoft.Data.SqlClient.
Thanks in advance for any help.