Visual Studio中将新增的项目自动设为启动项
在Addins的OnConnection中:
_applicationObject.Events.SolutionEvents.ProjectAdded += new _dispSolutionEvents_ProjectAddedEventHandler(SolutionEvents_ProjectAdded);
SolutionEvents_ProjectAdded方法实现:
void SolutionEvents_ProjectAdded(Project Project)
{
//当有新项目加入的时候自动设置其为自动启动项目
EnvDTE.SolutionClass sol = (EnvDTE.SolutionClass)_applicationObject.DTE.Solution;
sol.SolutionBuild.StartupProjects = new object[] { Project.UniqueName };
//Microsoft.VisualBasic.Information.TypeName(obj);
}