Dataconnectiondialog giving error in Visual Studio 2017

Asked

Viewed 104 times

1

I’m migrating to the Visual Studio 2017 a legacy project that uses a modal window to collect database connection data and format a string connecting.

The code below shows an error:

var dialog = new DataConnectionDialog();

Could not load file or Assembly 'Microsoft.Data.Connectionui, Version=0.0.0.0, Culture=neutral, Publickeytoken=f4ca07f51760da93' or one of its dependencies. The system cannot find the file specified.: System.IO.Filenotfoundexception: Could not load file or Assembly 'Microsoft.Data.Connectionui, Version=0.0.0.0, Culture=neutral, Publickeytoken=f4ca07f51760da93' or one of its dependencies. The system cannot find the file specified. File name: 'Microsoft.Data.Connectionui, Version=0.0.0.0, Culture=neutral, Publickeytoken=f4ca07f51760da93' at Microsoft.Data.Connectionui.DataConnectionDialog.. ctor() at Wings4cloudpackage.Forms.frmNewSolution.btnDatabase_Click(Object Sender, Eventargs and)

=== Pre-bind state information === LOG: Displayname = Microsoft.Data.Connectionui, Version=0.0.0.0, Culture=neutral, Publickeytoken=f4ca07f51760da93 (Fully-specified) LOG: Appbase = file://C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/Common7/IDE/ LOG: Initial Privatepath = NULL Calling Assembly : Microsoft.Data.Connectionui.Dialog, Version=0.0.0.0, Culture=neutral, Publickeytoken=f4ca07f51760da93. === LOG: This bind Starts in Loadfrom load context. WRN: Native image will not be probed in Loadfrom context. Native image will only be probed in default load context, like with Assembly.Load().

I already checked the directory: C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/Common7/IDE/ and the referenced dll (Microsoft.Data.ConnectionUI.dll) is there.

The project uses the following nuget package to display the dialog box: Dataconnectiondialog (https://www.nuget.org/packages/DataConnectionDialog/1.1.0)

This code works on VS2013, but not in the VS2017.

1 answer

1

Good, the package you are using was taken from Nuget.

The Owner has unlisted this package. This could Mean that the package is deprecated or shouldn’t be used anymore.

Use this and it will solve your problem:

Install-Package com.rusanu.dataconnectiondialog

The syntax has changed a bit in this package:

var str = new SqlConnectionStringBuilder();
var dialog = new DataConnectionDialog(str);
dialog.Show();

inserir a descrição da imagem aqui

Browser other questions tagged

You are not signed in. Login or sign up in order to post.