Pregunta

Estoy tratando de obtener la conexión actual usando SQL Server 2014 (Visual Studio 2013), pero sigo recibiendo el servicio "Microsoft.sqlserverververververver.management.ui.vsintegration.servicecache 'existe en' sqlpackagebase.dll 'y 'Microsoft.sqlserver.sqltools.vsintegration.dll' cuando puse un punto de interrupción en la llamada Servicecache.Alguien sabe de una solución para esto?Cualquier ayuda es muy apreciada!

my references are:
Microsoft.SqlServer.ConnectionInfo.dll
Microsoft.SqlServer.Management.Sdk.SqlStudio.dll
Microsoft.SqlServer.Management.SqlStudio.Explorer.dll
Microsoft.SqlServer.RegSvrEnum.dll
Microsoft.SqlServer.Smo.dll
Microsoft.SqlServer.SqlTools.VSIntegration.dll
ObjectExplorer.dll
SQLEditors.dll
SqlWorkbench.Interfaces.dll

using System.Reflection;
using System.Globalization;
using Microsoft.SqlServer.Management.UI.VSIntegration;
using Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer;
using Microsoft.SqlServer.Management.Common;
using Microsoft.SqlServer.Management.Smo;
using Microsoft.SqlServer.Management.Smo.RegSvrEnum;
using Microsoft.SqlServer.Management.SqlStudio.Explorer;

namespace NewAddin
{
/// <summary>The object for implementing an Add-in.</summary>
/// <seealso class='IDTExtensibility2' />
public class Connect : IDTExtensibility2, IDTCommandTarget
{
/// <summary>Implements the constructor for the Add-in object. Place your      initialization code within this method.</summary>
public Connect()
{
}

SqlConnectionInfo _myCurrentConnection = null;
private UIConnectionInfo currentUIConnection;


/// <summary>Implements the OnConnection method of the IDTExtensibility2 interface. Receives notification that the Add-in is being loaded.</summary>
/// <param term='application'>Root object of the host application.</param>
/// <param term='connectMode'>Describes how the Add-in is being loaded.</param>
/// <param term='addInInst'>Object representing this Add-in.</param>
/// <seealso class='IDTExtensibility2' />
public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom)
{
_applicationObject = (DTE2)application;
_addInInstance = (AddIn)addInInst;

if (Microsoft.SqlServer.Management.UI.VSIntegration.ServiceCache.ScriptFactory.CurrentlyActiveWndConnectionInfo != null)
{
//                _myCurrentConnection =     ServiceCache.ScriptFactory.CurrentlyActiveWndConnectionInfo.UIConnectionInfo;
currentUIConnection = ServiceCache.ScriptFactory.CurrentlyActiveWndConnectionInfo.UIConnectionInfo;

}

¿Fue útil?

Solución

Eliminar referencia a microsoft.sqlserver.sqltools.vsintegration.dll.Luego, agregue explícitamente una referencia al SQLPACKAEBASE.DLL

de la misma ubicación

c: \ Archivos de programa (x86) \ Microsoft SQL Server \ 110 \ Herramientas \ Binn \ ManageStudio \

Eso lo arregló para mí localmente.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top