DataConnectionDialog giving error in Visual Studio 2017

1

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

The code below displays 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 can not find the specified file:   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 can not 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 e)

     

=== 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 have 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: DataConnectionDialog ( link )

This code works on VS2013 , but not on VS2017 .

    
asked by anonymous 22.12.2017 / 20:57

1 answer

1

Well, the package you are using has been removed from Nuget.

  

The owner has unlisted this package. This could mean that the package   is deprecated or should not be used anymore.

Use this and resolve your issue:

  

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();

    
24.12.2017 / 09:59