public Core() { Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, "Start Core(): {0}", this.ToString())); //SolutionEventsListener class from http://stackoverflow.com/questions/2525457/automating-visual-studio-with-envdte // via Elisha http://stackoverflow.com/users/167149/elisha SolutionEventsListener = new SolutionEventsListener(); SolutionEventsListener.OnQueryUnloadProject += () => { CopiedFiles.RemoveAll(); }; Dte = Package.GetGlobalService(typeof(DTE)) as EnvDTE80.DTE2; Events = Dte.Events as Events2; var docEvents = Events.DocumentEvents; var projectEvents = Events.ProjectItemsEvents; var buildEvents = Events.BuildEvents; _events.Add(docEvents); _events.Add(projectEvents); _events.Add(buildEvents); docEvents.DocumentSaved += FileHandler.ItemSaved; projectEvents.ItemAdded += FileHandler.ItemAdded; projectEvents.ItemRemoved += FileHandler.ItemRemoved; projectEvents.ItemRenamed += FileHandler.ItemRenamed; buildEvents.OnBuildBegin += BuildHandler.BuildBegin; buildEvents.OnBuildDone += BuildHandler.BuildDone; }
public static void BuildDone(vsBuildScope buildScope, vsBuildAction buildAction) { Trace.WriteLine("Build done"); // Once the project has built then try and clean up the files copied into the Bootstrapper CopiedFiles.RemoveAll(); }
int IVsSolutionEvents.OnAfterCloseSolution(object pUnkReserved) { CopiedFiles.RemoveAll(); return(VSConstants.S_OK); }