當前位置: 首頁>>代碼示例>>C#>>正文


C# Framework.BuildFinishedEventArgs類代碼示例

本文整理匯總了C#中Microsoft.Build.Framework.BuildFinishedEventArgs的典型用法代碼示例。如果您正苦於以下問題:C# BuildFinishedEventArgs類的具體用法?C# BuildFinishedEventArgs怎麽用?C# BuildFinishedEventArgs使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


BuildFinishedEventArgs類屬於Microsoft.Build.Framework命名空間,在下文中一共展示了BuildFinishedEventArgs類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: VerifyEventType

        public void VerifyEventType()
        {
            BuildFinishedEventArgs buildFinished = new BuildFinishedEventArgs("Message", "Keyword", true);
            BuildStartedEventArgs buildStarted = new BuildStartedEventArgs("Message", "Help");
            BuildMessageEventArgs lowMessage = new BuildMessageEventArgs("Message", "help", "sender", MessageImportance.Low);
            TaskStartedEventArgs taskStarted = new TaskStartedEventArgs("message", "help", "projectFile", "taskFile", "taskName");
            TaskFinishedEventArgs taskFinished = new TaskFinishedEventArgs("message", "help", "projectFile", "taskFile", "taskName", true);
            TaskCommandLineEventArgs commandLine = new TaskCommandLineEventArgs("commandLine", "taskName", MessageImportance.Low);
            BuildWarningEventArgs warning = new BuildWarningEventArgs("SubCategoryForSchemaValidationErrors", "MSB4000", "file", 1, 2, 3, 4, "message", "help", "sender");
            BuildErrorEventArgs error = new BuildErrorEventArgs("SubCategoryForSchemaValidationErrors", "MSB4000", "file", 1, 2, 3, 4, "message", "help", "sender");
            TargetStartedEventArgs targetStarted = new TargetStartedEventArgs("message", "help", "targetName", "ProjectFile", "targetFile");
            TargetFinishedEventArgs targetFinished = new TargetFinishedEventArgs("message", "help", "targetName", "ProjectFile", "targetFile", true);
            ProjectStartedEventArgs projectStarted = new ProjectStartedEventArgs(-1, "message", "help", "ProjectFile", "targetNames", null, null, null);
            ProjectFinishedEventArgs projectFinished = new ProjectFinishedEventArgs("message", "help", "ProjectFile", true);
            ExternalProjectStartedEventArgs externalStartedEvent = new ExternalProjectStartedEventArgs("message", "help", "senderName", "projectFile", "targetNames");

            VerifyLoggingPacket(buildFinished, LoggingEventType.BuildFinishedEvent);
            VerifyLoggingPacket(buildStarted, LoggingEventType.BuildStartedEvent);
            VerifyLoggingPacket(lowMessage, LoggingEventType.BuildMessageEvent);
            VerifyLoggingPacket(taskStarted, LoggingEventType.TaskStartedEvent);
            VerifyLoggingPacket(taskFinished, LoggingEventType.TaskFinishedEvent);
            VerifyLoggingPacket(commandLine, LoggingEventType.TaskCommandLineEvent);
            VerifyLoggingPacket(warning, LoggingEventType.BuildWarningEvent);
            VerifyLoggingPacket(error, LoggingEventType.BuildErrorEvent);
            VerifyLoggingPacket(targetStarted, LoggingEventType.TargetStartedEvent);
            VerifyLoggingPacket(targetFinished, LoggingEventType.TargetFinishedEvent);
            VerifyLoggingPacket(projectStarted, LoggingEventType.ProjectStartedEvent);
            VerifyLoggingPacket(projectFinished, LoggingEventType.ProjectFinishedEvent);
            VerifyLoggingPacket(externalStartedEvent, LoggingEventType.CustomEvent);
        }
開發者ID:cameron314,項目名稱:msbuild,代碼行數:30,代碼來源:NodePackets_Tests.cs

示例2: BuildFinishedHandler

 void BuildFinishedHandler(object sender, BuildFinishedEventArgs e)
 {
     // Console.Write in the context of a unit test is very expensive.  A hundred
     // calls to Console.Write can easily take two seconds on a fast machine.  Therefore, only
     // do the Console.Write once at the end of the build.
     Console.Write(fullLog);
 }
開發者ID:nikson,項目名稱:msbuild,代碼行數:7,代碼來源:ProjectIdLogger.cs

示例3: FileLoggerBuildFinished

 private void FileLoggerBuildFinished(object sender, BuildFinishedEventArgs e)
 {
     if (_fileWriter != null)
     {
         _fileWriter.Flush();
     }
 }
開發者ID:nikson,項目名稱:msbuild,代碼行數:7,代碼來源:FileLogger.cs

示例4: BuildFinishedEventHandler

        /// <summary>
        /// Handles the BuildFinished event.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="BuildFinishedEventArgs" /> instance containing the event data.</param>
        private void BuildFinishedEventHandler(object sender, BuildFinishedEventArgs e)
        {
            Log("Warning", "Project", "File", "Line", "Column", "Message");

            foreach (var warning in _warnings.OrderBy(w => w.Code))
            {
                Log(warning.Code, warning.ProjectFile, warning.File, warning.LineNumber.ToString(), warning.ColumnNumber.ToString(), warning.Message);
            }
        }
開發者ID:codehulknet,項目名稱:test,代碼行數:14,代碼來源:CSVWarningsLogger.cs

示例5: BuildFinished

        private void BuildFinished(object sender, BuildFinishedEventArgs e)
        {
            this.handler(this, this.errors == 0 ? new ValEventArgs(e.Message, this.indent, Helper.MessageType.Success) : new ValEventArgs(e.Message, this.indent, Helper.MessageType.Error));

            this.handler(this, new ValEventArgs(string.Format(CultureInfo.InvariantCulture, "{0} Warning(s) ", this.warnings), this.indent));
            this.handler(this, new ValEventArgs(string.Format(CultureInfo.InvariantCulture, "{0} Error(s) ", this.errors) + Environment.NewLine + Environment.NewLine, this.indent));

            TimeSpan s = DateTime.UtcNow - this.startTime;
            this.handler(this, new ValEventArgs(string.Format(CultureInfo.InvariantCulture, "Time Elapsed {0}", s), this.indent));
        }
開發者ID:nagyist,項目名稱:MSBuildExplorer,代碼行數:10,代碼來源:MSBuildExplorerLogger.cs

示例6: EventArgsCtors

 public void EventArgsCtors()
 {
     BuildFinishedEventArgs buildFinishedEvent = new BuildFinishedEventArgs2();
     buildFinishedEvent = new BuildFinishedEventArgs("Message", "HelpKeyword", true);
     buildFinishedEvent = new BuildFinishedEventArgs("Message", "HelpKeyword", true, new DateTime());
     buildFinishedEvent = new BuildFinishedEventArgs("{0}", "HelpKeyword", true, new DateTime(), "Message");
     buildFinishedEvent = new BuildFinishedEventArgs(null, null, true);
     buildFinishedEvent = new BuildFinishedEventArgs(null, null, true, new DateTime());
     buildFinishedEvent = new BuildFinishedEventArgs(null, null, true, new DateTime(), null);
 }
開發者ID:JamesLinus,項目名稱:msbuild,代碼行數:10,代碼來源:BuildFinishedEventArgs_Tests.cs

示例7: HandleBuildFinished

 private void HandleBuildFinished(object sender, BuildFinishedEventArgs e)
 {
     if (e.Succeeded)
     {
         Console.WriteLine("Build succeeded. Warnings:{0}", m_warningCount);
     }
     else
     {
         Console.WriteLine("Build failed. Errors:{0} Warnings:{1}", m_errorCount, m_warningCount);
     }
 }
開發者ID:aggsol,項目名稱:Unity3DBuild,代碼行數:11,代碼來源:LoggerImpl.cs

示例8: AssignmentTest

		public void AssignmentTest ()
		{
			BuildFinishedEventArgs bfea;
			string message = "message";
			string helpKeyword = "helpKeyword";
			bool succeeded = true;
			
			bfea = new BuildFinishedEventArgs (message, helpKeyword, succeeded);
			
			Assert.AreEqual (message, bfea.Message, "Message");
			Assert.AreEqual (helpKeyword, bfea.HelpKeyword, "HelpKeyword");
			Assert.AreEqual (succeeded, bfea.Succeeded, "Succeeded");
		}
開發者ID:nlhepler,項目名稱:mono,代碼行數:13,代碼來源:BuildFinishedEventArgsTest.cs

示例9: BuildFinishedEventHandler

        /// <summary>
        /// Handles the BuildFinished event.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="BuildFinishedEventArgs"/> instance containing the event data.</param>
        private void BuildFinishedEventHandler(object sender, BuildFinishedEventArgs e)
        {
            foreach (var category in _categories)
            {
                foreach (var warning in category.Value.OrderBy(w => w.Code))
                {
                    Console.ForegroundColor = category.Key.Color;
                    Console.WriteLine("\n[{4}] {0} ({1},{2}): {3}", Path.Combine(Path.GetDirectoryName(warning.ProjectFile), warning.File ?? string.Empty), warning.LineNumber, warning.ColumnNumber, warning.Message, warning.Code);
                    Console.ResetColor();
                }
            }

            foreach (var warning in _warnings.OrderBy(w => w.Code))
            {
                Console.ForegroundColor = ConsoleColor.Yellow;
                Console.WriteLine("\n[{4}] {0} ({1},{2}): {3}", Path.Combine(Path.GetDirectoryName(warning.ProjectFile), warning.File ?? string.Empty), warning.LineNumber, warning.ColumnNumber, warning.Message, warning.Code);
                Console.ResetColor();
            }

            foreach (var error in _errors)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("\n[{4}] {0} ({1},{2}): {3}", Path.Combine(Path.GetDirectoryName(error.ProjectFile), error.File ?? string.Empty), error.LineNumber, error.ColumnNumber, error.Message, error.Code);
                Console.ResetColor();
            }

            Console.WriteLine();

            if (_categories.Count > 0)
            {
                foreach (var category in _categories)
                {
                    Console.ForegroundColor = category.Key.Color;
                    Console.Write("   {0} categorized warnings", category.Value.Count);
                    Console.WriteLine(!string.IsNullOrWhiteSpace(category.Key.Description) ? string.Format(" ({0})", category.Key.Description) : string.Empty);
                    Console.ResetColor();
                }
            }

            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.WriteLine("   {0} warnings", _warnings.Count);
            Console.ResetColor();

            Console.ForegroundColor = ConsoleColor.Red;
            Console.WriteLine("   {0} errors\n", _errors.Count);
            Console.ResetColor();

            var buildFinishedTimeStamp = DateTime.Now;
            var timeSpan = buildFinishedTimeStamp - _buildStartedTimeStamp;
            Console.WriteLine("   Build finished at {0} in {1}.", buildFinishedTimeStamp, string.Format("{0:m\\:ss} minutes", timeSpan));
        }
開發者ID:codehulknet,項目名稱:test,代碼行數:56,代碼來源:MinimalConsoleLogger.cs

示例10: BuildFinishedHandler

        /// <summary>
        /// This is the delegate for BuildFinishedHandler events.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="buildEvent"></param>
        protected override void BuildFinishedHandler(object sender, BuildFinishedEventArgs buildEvent)
        {
            base.BuildFinishedHandler(sender, buildEvent);

            var msg =
                (BuildTargetName ?? "Build") +
                (buildEvent.Succeeded ? " succeeded -- " : " failed -- ") +
                (!buildEvent.Succeeded ? TaskCount(TaskErrorCategory.Error) + " errors, " : "") +
                (TaskCount(TaskErrorCategory.Warning) + " warnings. ") +
                ("Build took: " + _timer.Elapsed + ".") +
                Environment.NewLine;

            QueueOutputEvent(MessageImportance.High, new BuildFinishedEventArgs(msg, string.Empty, buildEvent.Succeeded));
        }
開發者ID:89sos98,項目名稱:nemerle,代碼行數:19,代碼來源:NemerleIdeBuildLogger.cs

示例11: BuildFinished

 void BuildFinished(object sender, BuildFinishedEventArgs e)
 {
     Console.ForegroundColor = ConsoleColor.White;
     if (e.Succeeded)
     {
         Console.ForegroundColor = ConsoleColor.DarkGreen;
         Console.WriteLine("Compilation SUCCEEDED! Errors:{0} Warnings:{1}",ErrorCount,WarningCount);
     }
     else
     {
         Console.ForegroundColor = ConsoleColor.DarkRed;
         Console.WriteLine("Compilation FAILED! Errors:{0} Warnings:{1}",ErrorCount,WarningCount);
     }
     Console.BackgroundColor = ConsoleColor.Black;
 }
開發者ID:fredpointzero,項目名稱:UnityBuild,代碼行數:15,代碼來源:LoggerImpl.cs

示例12: CompleteBuild

        /// <summary>
        /// Completes the build and writes to the XML log file.
        /// </summary>
        /// <param name="buildFinishedEventArgs">The <see cref="BuildFinishedEventArgs"/> instance containing the event data.</param>
        /// <param name="logFile">The XML log file.</param>
        public void CompleteBuild(BuildFinishedEventArgs buildFinishedEventArgs, string logFile, int errorCount, int warningCount)
        {
            EndTime = buildFinishedEventArgs.Timestamp;
            var document = new XDocument();
            var root = new XElement("Build",
                new XAttribute("BuildSucceeded", buildFinishedEventArgs.Succeeded),
                new XAttribute("StartTime", StartTime),
                new XAttribute("EndTime", EndTime),
                new XAttribute("Errors", errorCount),
                new XAttribute("Warnings", warningCount));

            document.Add(root);
            SaveToElement(root);

            document.Save(logFile);
        }
開發者ID:cameron314,項目名稱:msbuild,代碼行數:21,代碼來源:Build.cs

示例13: BuildFinished

 void BuildFinished(object sender, BuildFinishedEventArgs e)
 {
     _stopwatch.Stop();
     Console.WriteLine();
     Console.WriteLine();
     Console.WriteLine("Compilation done in {0}ms.", _stopwatch.ElapsedMilliseconds);
     Console.WriteLine();
     Console.ForegroundColor = ConsoleColor.White;
     if (e.Succeeded)
     {
         Console.BackgroundColor = ConsoleColor.DarkGreen;
         Console.WriteLine("Compilation SUCCEEDED.");
     }
     else
     {
         Console.BackgroundColor = ConsoleColor.DarkRed;
         Console.WriteLine("Compilation FAILED!.");
     }
     Console.BackgroundColor = ConsoleColor.Black;
 }
開發者ID:wpoch,項目名稱:SublimeLogger,代碼行數:20,代碼來源:LoggerImpl.cs

示例14: BuildFinishedHandler

 /// <summary>
 /// This is the delegate for BuildFinishedHandler events.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="buildEvent"></param>
 private void BuildFinishedHandler(object sender, BuildFinishedEventArgs buildEvent)
 {
     if (LogAtImportance(buildEvent.Succeeded ? MessageImportance.Low :
                                                MessageImportance.High))
     {
         if (this.outputWindowPane != null)
             this.outputWindowPane.OutputStringThreadSafe(Environment.NewLine);
         LogEvent(sender, buildEvent);
     }
 }
開發者ID:Jeremiahf,項目名稱:wix3,代碼行數:15,代碼來源:idebuildlogger.cs

示例15: ForwardEvents

        public void ForwardEvents()
        {
            BuildStartedEventArgs buildStarted = new BuildStartedEventArgs("Message", "Help");
            BuildFinishedEventArgs buildFinished = new BuildFinishedEventArgs("Message", "Keyword", true);
            BuildMessageEventArgs normalMessage = new BuildMessageEventArgs("Message2", "help", "sender", MessageImportance.Normal);

            EventSourceSink loggerSource = AttachForwardingLoggerAndRedirector(buildStarted);
            loggerSource.Consume(buildStarted);

            loggerSource = AttachForwardingLoggerAndRedirector(buildFinished);
            loggerSource.Consume(buildFinished);

            loggerSource = AttachForwardingLoggerAndRedirector(normalMessage);
            loggerSource.Consume(normalMessage);
        }
開發者ID:JamesLinus,項目名稱:msbuild,代碼行數:15,代碼來源:CentralForwardingLogger_Tests.cs


注:本文中的Microsoft.Build.Framework.BuildFinishedEventArgs類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。