Esempio n. 1
0
        public static void ViewProjectDependencies(MainPackage package, DTE dte)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            List <Project> selectedProjects = new();

            if (!GetSelectedProjects(dte, selectedProjects, true))
            {
                package.ShowMessageBox("One or more projects (or the solution) must be selected in Solution Explorer.");
            }
            else
            {
                Graph     graph    = new(selectedProjects, MainPackage.ProjectOptions);
                XDocument graphXml = graph.CreateDgmlDocument(dte.Edition);

                string tempFileName = Path.Combine(Path.GetTempPath(), "Project Dependencies.dgml");
                graphXml.Save(tempFileName);

                // Technically, the "Graph Document Editor" has a ViewKind of "{295A0962-5A59-4F4F-9E12-6BC670C15C3B}".
                // However, the default works fine. It should open the document in the XML editor if the DGML editor isn't installed.
                dte.ItemOperations.OpenFile(tempFileName);
            }
        }