我为MSVS 2012开发了一个加载项。我需要获得当前打开的tsql选项卡的连接字符串。
我在MSVS 2010中使用IScriptFactory接口成员获取连接字符串(我使用IScriptFactory属性)。Microsoft.SqlServer.SqlTools.VSIntegration.VS.dll程序集中定义了IScriptFactory接口。
对于SSMS 2012,我使用相同的接口,但定义在SqlPackageBase.dll程序集中。
我找不到Microsoft.SqlServer.SqlTools.VSIntegration.VS.dll或SqlPackageBase.dll程序集在MSVS 2012 (终极RTM)安装文件夹。
此外,我试图在所有已安装的MSVS 2012程序集中找到CurrentlyActiveWndConnectionInfo类和IScriptFactory接口,但一无所获。
如何在msvs2012中获得当前tsql选项卡的连接字符串?
发布于 2012-09-26 09:43:47
Server\110\Tools\Binn\ManagementStudio\Extensions\Application\SQLEditors.dll ("...\Microsoft SQL ...\Microsoft ")程序集包含所需的信息。我尝试使用ScriptFactory.Instance.CurrentlyActiveWndConnectionInfo属性,但它生成InvalidOperationException。以下是CurrentlyActiveWndConnectionInfo属性分解的结果:
public CurrentlyActiveWndConnectionInfo CurrentlyActiveWndConnectionInfo
{
get
{
STrace.Params("ScriptFactory", "ScriptFactory.CurrentlyActiveWndConnectionInfo", string.Empty, null);
if (ServiceCache.VSMonitorSelection == null)
{
STrace.LogExThrow();
throw new InvalidOperationException();
}
return this.GetCurrentlyActiveWndConnectionInfo(ServiceCache.VSMonitorSelection);
}
}我认为空ServiceCache.VSMonitorSelection中的问题。
https://stackoverflow.com/questions/12456924
复制相似问题