我编写了一个控制台应用程序,该应用程序使用EnvDTE处理大约10种解决方案并以编程方式对其进行重构-更改引用和项目结构
var envDteType = Type.GetTypeFromProgID("VisualStudio.DTE.15.0");
var envDte = Activator.CreateInstance(envDteType, true);
var dte2 = (DTE2)envDte;
var solution = (Solution4)dte2.Solution;
solution.Open(filename);
// execute various tasks
solution.Close();
// how to dispose of dte2?
诀窍是,当我的应用程序完成时,大概是由EnvDTE打开的Visual Studio进程仍在运行。我关闭了唯一一个明显正在运行的Visual Studio实例,并且它们仍然存在。
是否可以关闭EnvDTE对象产生的那些进程?
以下内容似乎无效
dte2.Application.ActiveWindow.Close();
答案 0 :(得分:1)
Hans'是正确的- getCalendarEvents(): Array<CalendarEvent> {
var listCal:any = []
this.getCalendarData().subscribe((data: any) => {
listCal = data;
console.log('listCal data: ', listCal);
let startDate: Date,
endDate: Date,
event: CalendarEvent;
let colors: Array<Color> = [new Color(200, 188, 26, 214), new Color(220, 255, 109, 130), new Color(255, 55, 45, 255), new Color(199, 17, 227, 10), new Color(255, 255, 54, 3)];
let events: Array<CalendarEvent> = new Array<CalendarEvent>();
for (let i = 1; i < listCal.length; i++) {
event = new CalendarEvent(listCal[i].title, new Date(listCal[i].date), new Date(listCal[i].date), false, colors[i * 10 % (listCal[i].colour.length - 1)]);
events.push(event);
}
//console.log(events);
return events;
}
);
//return events; HERE the events has no data because I am outside the .subscribe!
}
完成了工作