Beispiel #1
0
        public override void OnBuildDone(vsBuildScope scope, vsBuildAction action)
        {
            base.OnBuildDone(scope, action);

            var build = new BuildEvent
            {
                SolutionName = Dte.Solution.FullName,
            };

            var filesWithErrors = new List <string>();

            //start at 1 when iterating through Error List
            for (var i = 1; i <= Dte.ToolWindows.ErrorList.ErrorItems.Count; i++)
            {
                var item = Dte.ToolWindows.ErrorList.ErrorItems.Item(i);
                var beli = new BuildEventErrorListItem
                {
                    BuildEvent    = build,
                    ErrorListItem = TypeConverters.ErrorItemToErrorListItem(item)
                };

                //only worry about critical errors
                if (!string.IsNullOrWhiteSpace(beli.ErrorListItem.CriticalErrorName))
                {
                    build.ErrorItems.Add(beli);

                    //add the file with the error to our list of items that have errors
                    if (filesWithErrors.Contains(beli.ErrorListItem.File.ToLower()) == false)
                    {
                        filesWithErrors.Add(beli.ErrorListItem.File.ToLower());
                    }
                }
            }

            //add in breakpoint information
            for (var i = 1; i <= Dte.Debugger.Breakpoints.Count; i++)
            {
                var bebp = new BuildEventBreakPoint
                {
                    BreakPoint =
                        TypeConverters.IdeBreakPointToBreakPoint(Dte.Debugger.Breakpoints.Item(i)),
                    BuildEvent = build
                };
                build.Breakpoints.Add(bebp);
            }

            //get all files in the solution
            var files = SolutionHelpers.GetSolutionFiles(Dte.Solution);

            //add in associated documents
            foreach (var bd in files.Select(file => new BuildDocument
            {
                Build = build,
                Document = file
            }))
            {
                build.Documents.Add(bd);
            }

            EventFactory.ToZippedBinary(build);

            //let others know that we have created a new event
            NotifyEventCreated(this, new EventCreatedArgs(build));

            CheckInterventionStatus();
        }
        public override void OnBuildDone(vsBuildScope Scope, vsBuildAction Action)
        {
            base.OnBuildDone(Scope, Action);

            //this might take a while, so throw it in its own thread
            //System.Threading.Tasks.Task.Factory.StartNew(
            //    () =>
            //    {
            BuildEvent    build           = new BuildEvent();
            List <string> filesWithErrors = new List <string>();

            build.SolutionName = dte.Solution.FullName;
            build.EventDate    = DateTime.UtcNow;

            //start at 1 when iterating through Error List
            for (int i = 1; i <= dte.ToolWindows.ErrorList.ErrorItems.Count; i++)
            {
                ErrorItem item = dte.ToolWindows.ErrorList.ErrorItems.Item(i);
                BuildEventErrorListItem beli = new BuildEventErrorListItem();
                beli.BuildEvent    = build;
                beli.ErrorListItem = ErrorListItem.FromErrorItem(item);

                //only worry about critical errors
                if (beli.ErrorListItem.CriticalErrorName.Length > 0)
                {
                    build.ErrorItems.Add(beli);

                    //add the file with the error to our list of items that have errors
                    if (filesWithErrors.Contains(beli.ErrorListItem.File.ToLower()) == false)
                    {
                        filesWithErrors.Add(beli.ErrorListItem.File.ToLower());
                    }
                }
            }

            //add in breakpoint information
            for (int i = 1; i <= dte.Debugger.Breakpoints.Count; i++)
            {
                BreakPoint           bp   = new BreakPoint(dte.Debugger.Breakpoints.Item(i));
                BuildEventBreakPoint bebp = new BuildEventBreakPoint();
                bebp.BreakPoint = bp;
                bebp.BuildEvent = build;
                build.Breakpoints.Add(bebp);
            }

            //get all files in the solution
            List <CodeDocument> files = build.GetSolutionFiles(dte.Solution);

            //add in associated documents
            foreach (CodeDocument file in files)
            {
                BuildDocument bd = new BuildDocument();
                bd.Build    = build;
                bd.Document = file;
                build.Documents.Add(bd);
            }

            byte[] data = EventFactory.ToZippedBinary(build);

            //let others know that we have created a new event
            NotifyEventCreated(this, new EventCreatedArgs(build));
            //}
            //);
        }