Exemplo n.º 1
0
        /// <summary>
        /// Gets the current solution.
        /// </summary>
        public Solution?GetCurrentSolution()
        {
            ThreadHelper.ThrowIfNotOnUIThread();
            IVsHierarchy     solution = VS.GetRequiredService <SVsSolution, IVsHierarchy>();
            IVsHierarchyItem?hierItem = solution.ToHierarchyItem(VSConstants.VSITEMID_ROOT);

            return(SolutionItem.FromHierarchyItem(hierItem) as Solution);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Gets the current solution.
        /// </summary>
        public async Task <Solution?> GetCurrentSolutionAsync()
        {
            await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

            IVsHierarchy solution = (IVsHierarchy)await VS.Services.GetSolutionAsync();

            IVsHierarchyItem?hierItem = await solution.ToHierarchyItemAsync(VSConstants.VSITEMID_ROOT);

            return(SolutionItem.FromHierarchyItem(hierItem) as Solution);
        }