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


C# Framework.BuildErrorEventArgs類代碼示例

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


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

示例1: ErrorRaised

 public void ErrorRaised(object sender, BuildErrorEventArgs e)
 {
     // BuildErrorEventArgs adds LineNumber, ColumnNumber, File, amongst other parameters
     string line = string.Format("{3}: Error {0}({1},{2}): ", e.File, e.LineNumber, e.ColumnNumber, e.Message);
     this.handler(this, new ValEventArgs(line, this.indent));
     this.errors++;
 }
開發者ID:nagyist,項目名稱:MSBuildExplorer,代碼行數:7,代碼來源:MSBuildExplorerLogger.cs

示例2: EventSourceErrorRaised

		void EventSourceErrorRaised (object sender, BuildErrorEventArgs e)
		{
			string file = e.File;
			if (file != null)
				file = Path.GetFullPath (Path.Combine (basePath, file));
			results.Add (new MSBuildResult (false, file, e.LineNumber, e.ColumnNumber, e.Code, e.Message));
		}
開發者ID:transformersprimeabcxyz,項目名稱:monodevelop-1,代碼行數:7,代碼來源:LocalLogger.cs

示例3: FormatErrorEvent

 public override string FormatErrorEvent(BuildErrorEventArgs args)
 {
     return (string.Format(Resources.ERROR_MESSAGE.Replace(@"\t", "\t"),
                           trimPath(args.ProjectFile),
                           trimPath(args.File),
                           args.LineNumber, args.ColumnNumber, args.Message));
 }
開發者ID:Hiroaki-Kubota,項目名稱:MSBuildLoggers,代碼行數:7,代碼來源:TSVConsoleLogger.cs

示例4: LogBuildEvents

        public void LogBuildEvents()
        {
            // This event should only be logged when OnlyLogCriticalEvents is off
            BuildMessageEventArgs messageEvent = new BuildMessageEventArgs("MyMessage", "HelpKeyword", "Sender", MessageImportance.High);

            // These three should be logged when OnlyLogCritical Events is on or off
            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");
            ExternalProjectStartedEventArgs externalStartedEvent = new ExternalProjectStartedEventArgs("message", "help", "senderName", "projectFile", "targetNames");

            ProcessBuildEventHelper loggingService = (ProcessBuildEventHelper)ProcessBuildEventHelper.CreateLoggingService(LoggerMode.Synchronous, 1);

            // Verify when OnlyLogCriticalEvents is false
            LogandVerifyBuildEvent(messageEvent, loggingService);
            LogandVerifyBuildEvent(warning, loggingService);
            LogandVerifyBuildEvent(error, loggingService);
            LogandVerifyBuildEvent(externalStartedEvent, loggingService);

            // Verify when OnlyLogCriticalEvents is true
            loggingService.OnlyLogCriticalEvents = true;
            loggingService.LogBuildEvent(messageEvent);
            Assert.IsNull(loggingService.ProcessedBuildEvent, "Expected ProcessedBuildEvent to be null");
            LogandVerifyBuildEvent(warning, loggingService);
            LogandVerifyBuildEvent(error, loggingService);
            LogandVerifyBuildEvent(externalStartedEvent, loggingService);
        }
開發者ID:ChronosWS,項目名稱:msbuild,代碼行數:26,代碼來源:LoggingServicesLogMethod_Tests.cs

示例5: 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

示例6: ErrorRaised

 /// <summary>
 /// Handles error notification events by storing the error message String.
 /// </summary>
 void ErrorRaised(object sender, BuildErrorEventArgs e)
 {
     _errors.Add(e.Message);
     #if DEBUG
     Debug.WriteLine("CONTENT: " + e.Message);
     #endif
 }
開發者ID:eropple,項目名稱:XnaContent,代碼行數:10,代碼來源:ErrorLogger.cs

示例7: AssignmentTest

		public void AssignmentTest ()
		{
			BuildErrorEventArgs beea;
			string subcategory = "subcategory";
			string code = "CS0000";
			string file = "file";
			int lineNumber = 1;
			int columnNumber = 2;
			int endLineNumber = 3;
			int endColumnNumber = 4;
			string message = "message";
			string helpKeyword = "helpKeyword";
			string senderName = "MSBuild";
			
			beea = new BuildErrorEventArgs (subcategory, code, file, lineNumber, columnNumber, endLineNumber,
				endColumnNumber, message, helpKeyword, senderName);
			
			Assert.AreEqual (subcategory, beea.Subcategory, "Subcategory");
			Assert.AreEqual (code, beea.Code, "Code");
			Assert.AreEqual (file, beea.File, "File");
			Assert.AreEqual (lineNumber, beea.LineNumber, "LineNumber");
			Assert.AreEqual (columnNumber, beea.ColumnNumber, "ColumnNumber");
			Assert.AreEqual (endLineNumber, beea.EndLineNumber, "EndLineNumber");
			Assert.AreEqual (endColumnNumber, beea.EndColumnNumber, "EndColumnNumber");
			Assert.AreEqual (message, beea.Message, "Message");
			Assert.AreEqual (helpKeyword, beea.HelpKeyword, "HelpKeyword");
			Assert.AreEqual (senderName, beea.SenderName, "SenderName");
		}
開發者ID:KonajuGames,項目名稱:SharpLang,代碼行數:28,代碼來源:BuildErrorEventArgsTest.cs

示例8: eventSource_ErrorRaised

        void eventSource_ErrorRaised(object sender, BuildErrorEventArgs e)
        {
            //TODO: task list?
            var s = String.Format("{0}({1},{2}): error {3}: {4}\n",
                e.File, e.LineNumber, e.ColumnNumber, e.Code, e.Message);

            Log(s);
        }
開發者ID:ldematte,項目名稱:BlenXVSP,代碼行數:8,代碼來源:VSOutputLogger.cs

示例9: ErrorRaised

 void ErrorRaised(object sender, BuildErrorEventArgs e)
 {
     string fullPath = ProjectDirectory != null ? Path.Combine(ProjectDirectory, e.File) : e.File;
     Console.ForegroundColor = ConsoleColor.DarkRed;
     Console.WriteLine("{0}({1},{2})  error:{3}  {4}", fullPath, e.LineNumber, e.ColumnNumber, e.Code, e.Message);
     ErrorCount++;
     Console.ForegroundColor = ConsoleColor.White;
 }
開發者ID:fredpointzero,項目名稱:UnityBuild,代碼行數:8,代碼來源:LoggerImpl.cs

示例10: FormatEventMessage

        /// <summary>
        /// Format the error event message and all the other event data into
        /// a single string.
        /// </summary>
        /// <param name="e">Error to format</param>
        /// <returns>The formatted message string.</returns>
        internal static string FormatEventMessage(BuildErrorEventArgs e, bool removeCarriageReturn, bool showProjectFile)
        {
            ErrorUtilities.VerifyThrowArgumentNull(e, "e");

            // "error" should not be localized
            return FormatEventMessage("error", e.Subcategory, removeCarriageReturn ? EscapeCarriageReturn(e.Message) : e.Message,
                e.Code, e.File, showProjectFile ? e.ProjectFile : null, e.LineNumber, e.EndLineNumber,
                            e.ColumnNumber, e.EndColumnNumber, e.ThreadId);
        }
開發者ID:cameron314,項目名稱:msbuild,代碼行數:15,代碼來源:EventArgsFormatting.cs

示例11: EventSourceErrorRaised

		void EventSourceErrorRaised (object sender, BuildErrorEventArgs e)
		{
			//NOTE: as of Mono 3.2.7, e.ProjectFile does not exist, so we use our projectFile variable instead
			results.Add (new MSBuildTargetResult (
				projectFile, false, e.Subcategory, e.Code, e.File,
				e.LineNumber, e.ColumnNumber, e.ColumnNumber, e.EndLineNumber,
				e.Message, e.HelpKeyword)
			);;
		}
開發者ID:FreeBSD-DotNet,項目名稱:monodevelop,代碼行數:9,代碼來源:LocalLogger.cs

示例12: LogErrorEvent

        public void LogErrorEvent(BuildErrorEventArgs eventArgs)
        {
            Console.WriteLine(EventArgsFormatting.FormatEventMessage(eventArgs));
            _log += EventArgsFormatting.FormatEventMessage(eventArgs);
            ++_errors;

            _log += "\n";
            _upperLog = null;
        }
開發者ID:cameron314,項目名稱:msbuild,代碼行數:9,代碼來源:MockEngine.cs

示例13: EventArgsCtors

 public void EventArgsCtors()
 {
     BuildErrorEventArgs beea = new BuildErrorEventArgs2();
     beea = new BuildErrorEventArgs("Subcategory", "Code", "File", 1, 2, 3, 4, "Message", "HelpKeyword", "sender");
     beea = new BuildErrorEventArgs("Subcategory", "Code", "File", 1, 2, 3, 4, "Message", "HelpKeyword", "sender", DateTime.Now);
     beea = new BuildErrorEventArgs("Subcategory", "Code", "File", 1, 2, 3, 4, "{0}", "HelpKeyword", "sender", DateTime.Now, "Messsage");
     beea = new BuildErrorEventArgs(null, null, null, 1, 2, 3, 4, null, null, null);
     beea = new BuildErrorEventArgs(null, null, null, 1, 2, 3, 4, null, null, null, DateTime.Now);
     beea = new BuildErrorEventArgs(null, null, null, 1, 2, 3, 4, null, null, null, DateTime.Now, null);
 }
開發者ID:JamesLinus,項目名稱:msbuild,代碼行數:10,代碼來源:BuildErrorEventArgs_Tests.cs

示例14: eventSource_ErrorRaised

        void eventSource_ErrorRaised(object sender, BuildErrorEventArgs e)
        {
            // BUILDERROREVENTARGS ADDS LINENUMBER, COLUMNNUMBER, FILE, AMONGST OTHER PARAMETERS
            string line = String.Format(": ERROR {0}({1},{2}): ", e.File, e.LineNumber, e.ColumnNumber);

            using (StreamWriter sw = new StreamWriter("logfil.txt"))
            {
                sw.WriteLine(line);
            }
        }
開發者ID:M4ttsson,項目名稱:zealous-rutabaga,代碼行數:10,代碼來源:ConsoleLogger.cs

示例15: LogErrorWithFilename

		public static void LogErrorWithFilename (this Engine engine, string filename, string message,
				     params object[] messageArgs)
		{
			if (message == null)
				throw new ArgumentNullException ("message");
				
			BuildErrorEventArgs beea = new BuildErrorEventArgs (
				null, null, filename, 0, 0, 0, 0, FormatString (message, messageArgs),
				null, null);
			engine.EventSource.FireErrorRaised (engine, beea);
		}
開發者ID:nlhepler,項目名稱:mono,代碼行數:11,代碼來源:LogExtensions.cs


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