コード例 #1
0
        /// <summary>
        /// Returns the solution file (based on the startup project).
        /// </summary>
        /// <returns></returns>
        public FileInfo GetSolutionFileInfo()
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            if (_solutionFile == null)
            {
                VsItemInfo startupProject = GetStartupProject();

                if (startupProject != null)
                {
                    string solutionFullPath = startupProject.GetSolutionFullPath();

                    if (solutionFullPath != null)
                    {
                        _solutionFile = new FileInfo(solutionFullPath);
                    }
                }
            }
            return(_solutionFile);
        }
コード例 #2
0
        /// <summary>
        /// Returns the startup project (based on the build manager).
        /// </summary>
        /// <returns></returns>
        public VsItemInfo GetStartupProject()
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            if (_startupProject == null)
            {
                IVsSolutionBuildManager solutionBuildManager = GetVsSolutionBuildManager();

                if (solutionBuildManager != null)
                {
                    bool success = PackageHelper.Success(solutionBuildManager.get_StartupProject(out IVsHierarchy value));

                    if (success && value != null)
                    {
                        _startupProject = new VsItemInfo(value);
                    }
                }
            }
            return(_startupProject);
        }