/// <summary> /// Initialization of the package; this method is called right after the package is sited, so this is the place /// where you can put all the initialization code that rely on services provided by VisualStudio. /// </summary> protected override void Initialize() { Debug.WriteLine (string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString())); packageInstaller = ComponentModel.GetService<IVsPackageInstaller>(); pkgInstallerServices = ComponentModel.GetService<IVsPackageInstallerServices>(); base.Initialize(); // Add our command handlers for menu (commands must exist in the .vsct file) var mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService; if ( null != mcs ) { // Create the command for the menu item. var cSharpProjContextAddReferenceCommandId = new CommandID(GuidList.guidVSServiceStackCmdSet, (int)PkgCmdIDList.cmdidCSharpAddServiceStackReference); var cSharpProjectAddReferenceMenuCommand = new OleMenuCommand(CSharpAddReferenceCallback ,cSharpProjContextAddReferenceCommandId); cSharpProjectAddReferenceMenuCommand.BeforeQueryStatus += CSharpQueryAddMenuItem; mcs.AddCommand(cSharpProjectAddReferenceMenuCommand); var fSharpProjContextAddReferenceCommandId = new CommandID(GuidList.guidVSServiceStackCmdSet, (int)PkgCmdIDList.cmdidFSharpAddServiceStackReference); var fSharpProjectContextOleMenuCommand = new OleMenuCommand(FSharpAddReferenceCallback, fSharpProjContextAddReferenceCommandId); fSharpProjectContextOleMenuCommand.BeforeQueryStatus += FSharpQueryAddMenuItem; mcs.AddCommand(fSharpProjectContextOleMenuCommand); var vbNetProjContextAddReferenceCommandId = new CommandID(GuidList.guidVSServiceStackCmdSet, (int)PkgCmdIDList.cmdidVbNetAddServiceStackReference); var vbNetProjectContextOleMenuCommand = new OleMenuCommand(VbNetAddReferenceCallback, vbNetProjContextAddReferenceCommandId); vbNetProjectContextOleMenuCommand.BeforeQueryStatus += VbNetQueryAddMenuItem; mcs.AddCommand(vbNetProjectContextOleMenuCommand); var typeScriptProjContextAddReferenceCommandId = new CommandID(GuidList.guidVSServiceStackCmdSet, (int)PkgCmdIDList.cmdidTypeScriptAddServiceStackReference); var typeScriptProjectContextOleMenuCommand = new OleMenuCommand(TypeScriptAddReferenceCallback, typeScriptProjContextAddReferenceCommandId); typeScriptProjectContextOleMenuCommand.BeforeQueryStatus += TypeScriptQueryAddMenuItem; mcs.AddCommand(typeScriptProjectContextOleMenuCommand); var updateReferenceCommandId = new CommandID(GuidList.guidVSServiceStackCmdSet, (int)PkgCmdIDList.cmdidUpdateServiceStackReference); var updateReferenceMenuCommand = new OleMenuCommand(UpdateReferenceCallback, updateReferenceCommandId); updateReferenceMenuCommand.BeforeQueryStatus += QueryUpdateMenuItem; mcs.AddCommand(updateReferenceMenuCommand); } solutionEventsListener = new SolutionEventsListener(); solutionEventsListener.OnAfterOpenSolution += SolutionLoaded; }