如何在以编程方式在 visual studio 中打开项目时自动关闭或隐藏此 asp.net 主页 window

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

如何关闭或隐藏此页面?我创建了一个自定义项目模板,它输出 asp.net mvc 项目或 aspnet 核心模板,并将此页面作为选项卡式文档打开。如何以编程方式关闭它?

这是使用开发工具环境对象可以完成的方法

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();
                }
            }
}