Search code examples
c#asp.net-mvcvisual-studiovsixvs-extensibility

How to Auto close or hide this asp.net home page window when opened the project in visual studio programmatically


How to close or hide this page? I created a custom project template which outputs the asp.net mvc project or aspnet core template and opens this page as tabbed document. How to close this programmatically?

enter image description here


Solution

  • This is how it can be done using the development tool environment object

    public void RunFinished()
            {
               Solution2 soln = (Solution2)dte.Solution;
    //Close the .Net project overview home page from the output project to be created
                foreach (Window documentWindow in dte.Windows)
                {
                    //close all Document type of windows from the output project
                    if (documentWindow.Kind == "Document")
                    {
                        documentWindow.Close();
                    }
                }
    }