I develop an addin for MSVS 2012. I need to get connection string for tsql tab currently opened.
I used IScriptFactory interface members to get connection string in MSVS 2010 (I use ServiceCache.ScriptFactory.CurrentlyActiveWndConnectionInfo.UIConnectionInfo property). IScriptFactory interface is defined in Microsoft.SqlServer.SqlTools.VSIntegration.VS.dll assembly.
For SSMS 2012 I use the same interface but defined in SqlPackageBase.dll assembly.
I can find neither Microsoft.SqlServer.SqlTools.VSIntegration.VS.dll nor SqlPackageBase.dll assemblies in MSVS 2012 (Ultimate RTM) installed folder.
Also I tried to find CurrentlyActiveWndConnectionInfo class and IScriptFactory interface in all MSVS 2012 assemblies installed but found nothing.
How can I get connection string for current tsql tab in MSVS 2012?
SQLEditors.dll (“…\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\Extensions\Application\SQLEditors.dll
“) assembly contains required information.
I tried to use ScriptFactory.Instance.CurrentlyActiveWndConnectionInfo property but it generates InvalidOperationException.
Here is the result of CurrentlyActiveWndConnectionInfo property disassembling:
I think the problem in null ServiceCache.VSMonitorSelection.