• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Framework.BuildMessageEventArgs类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Microsoft.Build.Framework.BuildMessageEventArgs的典型用法代码示例。如果您正苦于以下问题:C# BuildMessageEventArgs类的具体用法?C# BuildMessageEventArgs怎么用?C# BuildMessageEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



BuildMessageEventArgs类属于Microsoft.Build.Framework命名空间,在下文中一共展示了BuildMessageEventArgs类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

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


示例2: LogMessage

 public static void LogMessage(this ITask task,string message, params object[] messageArgs)
 {
     var buildEngine = task.BuildEngine;
     
     BuildMessageEventArgs e = new BuildMessageEventArgs(string.Format(message, messageArgs), (string)null, task.GetType().Name, MessageImportance.Normal);
     buildEngine.LogMessageEvent(e);
 }
开发者ID:baseclass,项目名称:Contrib.Nuget,代码行数:7,代码来源:ITaskExtensions.cs


示例3: WriteInternal

        protected override void WriteInternal(WriteStyle style, string value)
        {
            // TODO: How do we normalize this with the current design? Perhaps hold lines without a line end until we get one?

            // MSBuild ALWAYS is a "Writeline"
            value = value.Trim('\f', '\n', '\r');
            if (string.IsNullOrWhiteSpace(value)) { return; }

            if (style.HasFlag(WriteStyle.Error))
            {
                LogError(value);
            }
            else if (style.HasFlag(WriteStyle.Critical))
            {
                LogWarning(value);
            }
            else
            {
                MessageImportance importance = MessageImportance.Normal;
                if (style.HasFlag(WriteStyle.Bold) || style.HasFlag(WriteStyle.Important))
                {
                    importance = MessageImportance.High;
                }

                BuildMessageEventArgs message = new BuildMessageEventArgs(
                    message: value,
                    helpKeyword: null,
                    senderName: _taskName,
                    importance: importance);

                _buildEngine.LogMessageEvent(message);
            }
        }
开发者ID:JeremyKuhne,项目名称:XTask,代码行数:33,代码来源:BuildLogger.cs


示例4: RaiseMessageEvent

        /// <summary>
        /// Raises a message event to all registered loggers.
        /// </summary>
        /// <owner>SumedhK</owner>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        internal void RaiseMessageEvent(object sender, BuildMessageEventArgs e)
        {
            if (MessageRaised != null)
            {
                try
                {
                    MessageRaised(sender, e);
                }
                catch (LoggerException)
                {
                    // if a logger has failed politely, abort immediately
                    // first unregister all loggers, since other loggers may receive remaining events in unexpected orderings
                    // if a fellow logger is throwing in an event handler.
                    this.UnregisterAllLoggers();
                    throw;
                }
                catch (Exception exception)
                {
                    // first unregister all loggers, since other loggers may receive remaining events in unexpected orderings
                    // if a fellow logger is throwing in an event handler.
                    this.UnregisterAllLoggers();
                    InternalLoggerException.Throw(exception, e, "FatalErrorWhileLogging", false);
                }
            }

            RaiseAnyEvent(sender, e);
        }
开发者ID:nikson,项目名称:msbuild,代码行数:33,代码来源:EventSource.cs


示例5: LogMessageEvent

		public void LogMessageEvent(BuildMessageEventArgs e)
		{
			if (MessageIsImportantEnough(e.Importance))
			{
				Console.WriteLine(e.Message);
			}
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:7,代码来源:StubBuildEngine.cs


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


示例7: Execute

 public bool Execute()
 {
     StreamReader streamreaderAssemblyInfo = null;
     Match matchVersion;
     Group groupVersion;
     string strLine;
     strAssemblyFileVersion = String.Empty;
     try
     {
         streamreaderAssemblyInfo = new StreamReader(strFilePathAssemblyInfo);
         while ((strLine = streamreaderAssemblyInfo.ReadLine()) != null)
         {
             matchVersion = Regex.Match(strLine, @"(?:AssemblyFileVersion\("")(?<ver>(\d*)\.(\d*)(\.(\d*)(\.(\d*))?)?)(?:""\))", RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace | RegexOptions.Singleline | RegexOptions.ExplicitCapture);
             if (matchVersion.Success)
             {
                 groupVersion = matchVersion.Groups["ver"];
                 if ((groupVersion.Success) && (!String.IsNullOrEmpty(groupVersion.Value)))
                 {
                     strAssemblyFileVersion = groupVersion.Value;
                     break;
                 }
             }
         }
     }
     catch (Exception e)
     {
         BuildMessageEventArgs args = new BuildMessageEventArgs(e.Message, string.Empty, "GetAssemblyFileVersion", MessageImportance.High);
         BuildEngine.LogMessageEvent(args);
     }
     finally { if (streamreaderAssemblyInfo != null) streamreaderAssemblyInfo.Close(); }
     return (true);
 }
开发者ID:RebelCMS,项目名称:rebelcmsxu5,代码行数:32,代码来源:GetAssemblyFileVersion.cs


示例8: AddTaskParameter

        /// <summary>
        /// Handler for a BuildMessage log event. Adds the node to the appropriate target.
        /// </summary>
        /// <param name="buildMessageEventArgs">The <see cref="BuildMessageEventArgs"/> instance containing the event data.</param>
        /// <param name="messagePrefix">The message prefix.</param>
        public void AddTaskParameter(BuildMessageEventArgs buildMessageEventArgs, string messagePrefix)
        {
            var project = GetOrAddProject(buildMessageEventArgs.BuildEventContext.ProjectContextId);
            var target = project.GetTargetById(buildMessageEventArgs.BuildEventContext.TargetId);
            var task = target.GetTaskById(buildMessageEventArgs.BuildEventContext.TaskId);

            task.AddParameter(TaskParameter.Create(buildMessageEventArgs.Message, messagePrefix));
        }
开发者ID:cameron314,项目名称:msbuild,代码行数:13,代码来源:Build.cs


示例9: eventSource_MessageRaised

        public void eventSource_MessageRaised(object sender, BuildMessageEventArgs e)
        {
            if((e.Importance == MessageImportance.High && IsVerbosityAtLeast(LoggerVerbosity.Minimal)) ||
               (e.Importance == MessageImportance.Normal && IsVerbosityAtLeast(LoggerVerbosity.Normal)) ||
			   (e.Importance == MessageImportance.Low && IsVerbosityAtLeast(LoggerVerbosity.Detailed)))
            {
                WriteMessage(e.Message);
            }
        }
开发者ID:alux-xu,项目名称:ice-builder-visualstudio,代码行数:9,代码来源:BuildLogger.cs


示例10: eventSource_MessageRaised

        void eventSource_MessageRaised(object sender, BuildMessageEventArgs e)
        {
            if (e.GetType() == typeof(TaskCommandLineEventArgs))
            {
                TaskCommandLineEventArgs cl = (TaskCommandLineEventArgs)e;

                MFuVisionGenerator.EnqueueItem(cl.Message, Directory.GetCurrentDirectory(), this.ProjectBuildContext);
            }
        }
开发者ID:AlexandrSurkov,项目名称:PKStudio,代码行数:9,代码来源:MessagesCollector.cs


示例11: TestLogMessageLogsABuildErrorWhenATsLintWarningOccurs

 public void TestLogMessageLogsABuildErrorWhenATsLintWarningOccurs()
 {
     mockBuildEngine.Setup(engine => engine.LogErrorEvent(It.IsAny<BuildErrorEventArgs>()));
     mockBuildEngine.Setup(engine => engine.LogMessageEvent(It.IsAny<BuildMessageEventArgs>()));
     BuildMessageEventArgs message = new BuildMessageEventArgs(
         @"(quotemark) Private\Welcome\Welcome.ts[4, 20]: ' should be """,
         string.Empty,
         string.Empty,
         MessageImportance.High);
     TsLintLogAnalyzer.LogMessage(mockBuildEngine.Object, message);
 }
开发者ID:mbraude,项目名称:NCapsulateExtensions.TsLint,代码行数:11,代码来源:TsLintLogAnalyzerTests.cs


示例12: Cancel

 /// <summary>
 /// Perform Cancel Code
 /// </summary>
 public void Cancel()
 {
     try
     {
         proc.Kill();
     }
     catch (Exception ex)
     {
         BuildMessageEventArgs taskEvent2 = new BuildMessageEventArgs(ex.Message, "", "", MessageImportance.High);
         BuildEngine.LogMessageEvent(taskEvent2);
     }
 }
开发者ID:hkopparru,项目名称:VSPlugin,代码行数:15,代码来源:MakeAllAndFormatOutputMessages.cs


示例13: eventSource_MessageRaised

 void eventSource_MessageRaised(object sender, BuildMessageEventArgs e)
 {
     // BuildMessageEventArgs adds Importance to BuildEventArgs
     // Let's take account of the verbosity setting we've been passed in deciding whether to log the message
     if ((e.Importance == MessageImportance.High && IsVerbosityAtLeast(LoggerVerbosity.Minimal))
         || (e.Importance == MessageImportance.Normal && IsVerbosityAtLeast(LoggerVerbosity.Normal))
         || (e.Importance == MessageImportance.Low && IsVerbosityAtLeast(LoggerVerbosity.Detailed))
         )
     {
         WriteLineWithSenderAndMessage(String.Empty, e);
     }
 }
开发者ID:twistedtwig,项目名称:NHibernateRepository,代码行数:12,代码来源:MsBuildLogger.cs


示例14: EventSourceMessageRaised

 private void EventSourceMessageRaised(object sender, BuildMessageEventArgs e)
 {
     // BuildMessageEventArgs adds Importance to BuildEventArgs
     // Let's take account of the verbosity setting we've been passed in deciding whether to log the message
     if ((e.Importance == MessageImportance.High && _verbosity == LoggerVerbosity.Minimal)
         || (e.Importance == MessageImportance.Normal && _verbosity == LoggerVerbosity.Normal)
         || (e.Importance == MessageImportance.Low && _verbosity == LoggerVerbosity.Detailed)
         )
     {
         WriteMessage(string.Empty, e);
     }
 }
开发者ID:BackupTheBerlios,项目名称:nantgui,代码行数:12,代码来源:GuiLogger.cs


示例15: AssignmentTest

		public void AssignmentTest ()
		{
			BuildMessageEventArgs bmea;
			string message = "message";
			string helpKeyword = "helpKeyword";
			string senderName = "senderName";
			MessageImportance messageImportance = MessageImportance.High;
			
			bmea = new BuildMessageEventArgs (message, helpKeyword, senderName, messageImportance);
			
			Assert.AreEqual (message, bmea.Message, "Message");
			Assert.AreEqual (helpKeyword, bmea.HelpKeyword, "HelpKeyword");
			Assert.AreEqual (senderName, bmea.SenderName, "SenderName");
			Assert.AreEqual (messageImportance, bmea.Importance, "Importance");
		}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:15,代码来源:BuildMessageEventArgsTest.cs


示例16: EventArgsCtors

 public void EventArgsCtors()
 {
     BuildMessageEventArgs bmea = new BuildMessageEventArgs2();
     bmea = new BuildMessageEventArgs("Message", "HelpKeyword", "Sender", MessageImportance.Low);
     bmea = new BuildMessageEventArgs("Message", "HelpKeyword", "Sender", MessageImportance.Low, DateTime.Now);
     bmea = new BuildMessageEventArgs("{0}", "HelpKeyword", "Sender", MessageImportance.Low, DateTime.Now, "Message");
     bmea = new BuildMessageEventArgs("Subcategory", "Code", "File", 1, 2, 3, 4, "Message", "HelpKeyword", "Sender", MessageImportance.Low);
     bmea = new BuildMessageEventArgs("Subcategory", "Code", "File", 1, 2, 3, 4, "Message", "HelpKeyword", "Sender", MessageImportance.Low, DateTime.Now);
     bmea = new BuildMessageEventArgs("Subcategory", "Code", "File", 1, 2, 3, 4, "{0}", "HelpKeyword", "Sender", MessageImportance.Low, DateTime.Now, "Message");
     bmea = new BuildMessageEventArgs(null, null, null, MessageImportance.Low);
     bmea = new BuildMessageEventArgs(null, null, null, MessageImportance.Low, DateTime.Now);
     bmea = new BuildMessageEventArgs(null, null, null, MessageImportance.Low, DateTime.Now, null);
     bmea = new BuildMessageEventArgs(null, null, null, 0, 0, 0, 0, null, null, null, MessageImportance.Low);
     bmea = new BuildMessageEventArgs(null, null, null, 0, 0, 0, 0, null, null, null, MessageImportance.Low, DateTime.Now);
     bmea = new BuildMessageEventArgs(null, null, null, 0, 0, 0, 0, null, null, null, MessageImportance.Low, DateTime.Now, null);
 }
开发者ID:JamesLinus,项目名称:msbuild,代码行数:16,代码来源:BuildMessageEventArgs_Tests.cs


示例17: TestConsumeMessageBuildEvent

        public void TestConsumeMessageBuildEvent()
        {
            bool wentInHandler = false;
            BuildMessageEventArgs messageEvent = new BuildMessageEventArgs("My message", "Help me keyword", "Sender", MessageImportance.High);
            SendDataDelegate transportDelegate = delegate (INodePacket packet)
                                                 {
                                                     wentInHandler = true;
                                                     LogMessagePacket loggingPacket = packet as LogMessagePacket;
                                                     Assert.NotNull(loggingPacket);
                                                     BuildMessageEventArgs messageEventFromPacket = loggingPacket.NodeBuildEvent.Value.Value as BuildMessageEventArgs;
                                                     Assert.Equal(messageEventFromPacket, messageEvent);
                                                 };

            BuildEventArgTransportSink transportSink = new BuildEventArgTransportSink(transportDelegate);
            transportSink.Consume(messageEvent, 0);
            Assert.True(wentInHandler); // "Expected to go into transport delegate"
        }
开发者ID:cameron314,项目名称:msbuild,代码行数:17,代码来源:BuildEventArgTransportSink_Tests.cs


示例18: eventSource_MessageRaised

		void eventSource_MessageRaised(object sender, BuildMessageEventArgs e)
		{
			if (_output == null || e.Importance == MessageImportance.Low || String.IsNullOrEmpty(e.Message))
				return;

			_output.WriteStartElement("message");
			try
			{
				_output.WriteAttributeString("level", e.Importance.ToString().ToLower());
				_output.WriteAttributeString("text", e.Message.Trim());
			}
			finally
			{
				_output.WriteEndElement();
				_output.Flush();
			}
		}
开发者ID:hivie7510,项目名称:csharptest-net,代码行数:17,代码来源:XmlLogger.cs


示例19: LogMessage

        public static bool LogMessage(IBuildEngine buildEngine, BuildMessageEventArgs args)
        {
            bool success = true;
            if (args.Importance == MessageImportance.High)
            {
                int index = 0;
                using (TextReader reader = new StringReader(args.Message))
                {
                    for (string line = reader.ReadLine(); line != null; line = reader.ReadLine())
                    {
                        Match match = tsLintRegex.Match(line);
                        if (match.Success)
                        {
                            int lineNumber = int.Parse(match.Groups["LineNumber"].Value);
                            int columnNumber = int.Parse(match.Groups["ColumnNumber"].Value);
                            BuildErrorEventArgs errorArgs = new BuildErrorEventArgs(
                                string.Empty,
                                string.Empty,
                                match.Groups["FileName"].Value,
                                lineNumber,
                                columnNumber,
                                0,
                                0,
                                match.Groups["End"].Value,
                                string.Empty,
                                string.Empty);
                            buildEngine.LogErrorEvent(errorArgs);
                            success = false;
                            index++;
                            if (index == 100)
                            {
                                break;
                            }
                        }
                    }
                }
            }

            buildEngine.LogMessageEvent(args);
            return success;
        }
开发者ID:mbraude,项目名称:NCapsulateExtensions.TsLint,代码行数:41,代码来源:TsLintLogAnalyzer.cs


示例20: Execute

        public override bool Execute()
        {
            try
            {

                TFVC _tfs = new TFVC();
                bool _changesetsFound = false;
                foreach (string _vcPath in _tfs.GetWorkspaceWorkingFolderServerMappings(_ws, _owner))
                {
                    BuildMessageEventArgs _bmsg = new BuildMessageEventArgs("Checking: " + _vcPath, "help", null, MessageImportance.Low);
                    BuildEngine.LogMessageEvent(_bmsg);
                    if (_tfs.Check4ChangeSetsSinceLabel(_lastGoodBuild, _vcPath))
                    {
                        BuildEngine.LogMessageEvent(new BuildMessageEventArgs("Changesets founds[" + _tfs.ChangesetsFoundCount + "]: " + _tfs.ChangesetsFound, "help", null, MessageImportance.Low));
                        _changesetsFound = true;
                        break;
                    }
                }

                if (_changesetsFound)
                {
                    return true;
                }
                else
                {
                    BuildErrorEventArgs _berror = new BuildErrorEventArgs("No Changes since last good build", "HIC:4201", null, 0, 0, 0, 0, "No changessets were found since the " + _lastGoodBuild, null, null);
                    BuildEngine.LogErrorEvent(_berror);
                    return false;
                }

            }
            catch (Exception _ex)
            {
                BuildErrorEventArgs _berr = new BuildErrorEventArgs(_ex.Message, _ex.StackTrace, _ex.Source, 0, 0, 0, 0, _ex.Message, _ex.HelpLink, null);
                BuildEngine.LogErrorEvent(_berr);
                return false;
            }
        }
开发者ID:hopenbr,项目名称:HopDev,代码行数:38,代码来源:Check4Changesets.cs



注:本文中的Microsoft.Build.Framework.BuildMessageEventArgs类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Framework.BuildStartedEventArgs类代码示例发布时间:2022-05-26
下一篇:
C# Framework.BuildFinishedEventArgs类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap