VsTeXProject.VisualStudio.Project.ProjectNode.AddProjectReference C# (CSharp) Method

AddProjectReference() public method

Override this method if you want to modify the behavior of the Add Reference dialog By example you could change which pages are visible and which is visible by default.
public AddProjectReference ( ) : int
return int
        public virtual int AddProjectReference()
        {
            CCITracing.TraceCall();

            IVsComponentSelectorDlg4 componentDialog;
            var strBrowseLocations = Path.GetDirectoryName(BaseURI.Uri.LocalPath);
            var tabInitList = new List<VSCOMPONENTSELECTORTABINIT>
            {
                new VSCOMPONENTSELECTORTABINIT
                {
                    guidTab = VSConstants.GUID_COMPlusPage,
                    varTabInitInfo = GetComponentPickerDirectories()
                },
                new VSCOMPONENTSELECTORTABINIT
                {
                    guidTab = VSConstants.GUID_COMClassicPage
                },
                new VSCOMPONENTSELECTORTABINIT
                {
                    // Tell the Add Reference dialog to call hierarchies GetProperty with the following
                    // propID to enablefiltering out ourself from the Project to Project reference
                    varTabInitInfo = (int) __VSHPROPID.VSHPROPID_ShowProjInSolutionPage,
                    guidTab = VSConstants.GUID_SolutionPage
                },
                // Add the Browse for file page            
                new VSCOMPONENTSELECTORTABINIT
                {
                    varTabInitInfo = 0,
                    guidTab = VSConstants.GUID_BrowseFilePage
                },
                new VSCOMPONENTSELECTORTABINIT
                {
                    guidTab = GUID_MruPage
                }
            };
            tabInitList.ForEach(tab => tab.dwSize = (uint) Marshal.SizeOf(typeof (VSCOMPONENTSELECTORTABINIT)));

            componentDialog = GetService(typeof (IVsComponentSelectorDlg)) as IVsComponentSelectorDlg4;
            try
            {
                // call the container to open the add reference dialog.
                if (componentDialog != null)
                {
                    // Let the project know not to show itself in the Add Project Reference Dialog page
                    ShowProjectInSolutionPage = false;
                    // call the container to open the add reference dialog.
                    var browseFilters = "Component Files (*.exe;*.dll)\0*.exe;*.dll\0";
                    ErrorHandler.ThrowOnFailure(componentDialog.ComponentSelectorDlg5(
                        (uint) (__VSCOMPSELFLAGS.VSCOMSEL_MultiSelectMode | __VSCOMPSELFLAGS.VSCOMSEL_IgnoreMachineName),
                        InteropSafeIVsComponentUser,
                        0,
                        null,
                        SR.GetString(SR.AddReferenceDialogTitle, CultureInfo.CurrentUICulture), // Title
                        "VS.AddReference", // Help topic
                        addComponentDialogSizeX,
                        addComponentDialogSizeY,
                        (uint) tabInitList.Count,
                        tabInitList.ToArray(),
                        ref addComponentLastActiveTab,
                        browseFilters,
                        ref strBrowseLocations,
                        TargetFrameworkMoniker.FullName));
                }
            }
            catch (COMException e)
            {
                Trace.WriteLine("Exception : " + e.Message);
                return e.ErrorCode;
            }
            finally
            {
                // Let the project know it can show itself in the Add Project Reference Dialog page
                ShowProjectInSolutionPage = true;
            }
            return VSConstants.S_OK;
        }
ProjectNode