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

C# Framework.BuildWarningEventArgs类代码示例

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

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



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

示例1: AssignmentTest

		public void AssignmentTest ()
		{
			BuildWarningEventArgs bwea;
			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 = "senderName";
			
			bwea = new BuildWarningEventArgs (subcategory, code, file, lineNumber, columnNumber, endLineNumber,
				endColumnNumber, message, helpKeyword, senderName);
			
			Assert.AreEqual (subcategory, bwea.Subcategory, "Subcategory");
			Assert.AreEqual (code, bwea.Code, "Code");
			Assert.AreEqual (file, bwea.File, "File");
			Assert.AreEqual (lineNumber, bwea.LineNumber, "LineNumber");
			Assert.AreEqual (columnNumber, bwea.ColumnNumber, "ColumnNumber");
			Assert.AreEqual (endLineNumber, bwea.EndLineNumber, "EndLineNumber");
			Assert.AreEqual (endColumnNumber, bwea.EndColumnNumber, "EndColumnNumber");
			Assert.AreEqual (message, bwea.Message, "Message");
			Assert.AreEqual (helpKeyword, bwea.HelpKeyword, "HelpKeyword");
			Assert.AreEqual (senderName, bwea.SenderName, "SenderName");
		}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:28,代码来源:BuildWarningEventArgsTest.cs


示例2: EventSourceWarningRaised

		void EventSourceWarningRaised (object sender, BuildWarningEventArgs e)
		{
			string file = e.File;
			if (file != null)
				file = Path.GetFullPath (Path.Combine (basePath, file));
			results.Add (new MSBuildResult (true, file, e.LineNumber, e.ColumnNumber, e.Code, e.Message));
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:7,代码来源:LocalLogger.cs


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


示例4: FormatWarningEvent

 public override string FormatWarningEvent(BuildWarningEventArgs args)
 {
     return (string.Format(Resources.WARNING_MESSAGE.Replace(@"\t", "\t"),
                           trimPath(args.ProjectFile),
                           trimPath(args.File),
                           args.LineNumber, args.ColumnNumber, args.Message));
 }
开发者ID:Hiroaki-Kubota,项目名称:MSBuildLoggers,代码行数:7,代码来源:TSVConsoleLogger.cs


示例5: Execute

 public override bool Execute()
 {
     var message = "CustomTask version is " + GetType().Assembly.GetName().Version;
     var args = new BuildWarningEventArgs("", "", "", 0, 0, 0, 0, message, "", "CustomTask");
     BuildEngine.LogWarningEvent(args);
     return true;
 }
开发者ID:rwecho,项目名称:Experiments,代码行数:7,代码来源:CustomTask.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: HandleWarningRaised

 private void HandleWarningRaised(object sender, BuildWarningEventArgs e)
 {
     var fullPath = m_projectDirectory != null ? Path.Combine(m_projectDirectory, e.File) : e.File;
     if (e.Code != null)
     {
         Console.WriteLine("{0}:{1}:{2}: Warning: {3}", fullPath, e.LineNumber, e.ColumnNumber, e.Message);
         m_warningCount++;
     }
 }
开发者ID:aggsol,项目名称:Unity3DBuild,代码行数:9,代码来源:LoggerImpl.cs


示例8: FormatEventMessage

        /// <summary>
        /// Format the warning message and all the other event data into a
        /// single string.
        /// </summary>
        /// <owner>t-jeffv, sumedhk</owner>
        /// <param name="e">Warning to format</param>
        /// <returns>The formatted message string.</returns>
        internal static string FormatEventMessage(BuildWarningEventArgs e, bool removeCarriageReturn)
        {
            ErrorUtilities.VerifyThrowArgumentNull(e, "e");

            // "warning" should not be localized
            return FormatEventMessage("warning", e.Subcategory, removeCarriageReturn ? EscapeCarriageReturn(e.Message) : e.Message,
                           e.Code, e.File, e.LineNumber, e.EndLineNumber,
                           e.ColumnNumber, e.EndColumnNumber, e.ThreadId);
        }
开发者ID:nikson,项目名称:msbuild,代码行数:16,代码来源:EventArgsFormatting.cs


示例9: EventSourceWarningRaised

		void EventSourceWarningRaised (object sender, BuildWarningEventArgs 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, true, 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


示例10: EventArgsCtors

 public void EventArgsCtors()
 {
     BuildWarningEventArgs buildWarningEvent = new BuildWarningEventArgs2();
     buildWarningEvent = new BuildWarningEventArgs("Subcategory", "Code", "File", 1, 2, 3, 4, "Message", "HelpKeyword", "sender");
     buildWarningEvent = new BuildWarningEventArgs("Subcategory", "Code", "File", 1, 2, 3, 4, "Message", "HelpKeyword", "sender", DateTime.Now);
     buildWarningEvent = new BuildWarningEventArgs("Subcategory", "Code", "File", 1, 2, 3, 4, "{0}", "HelpKeyword", "sender", DateTime.Now, "Message");
     buildWarningEvent = new BuildWarningEventArgs(null, null, null, 1, 2, 3, 4, null, null, null);
     buildWarningEvent = new BuildWarningEventArgs(null, null, null, 1, 2, 3, 4, null, null, null, DateTime.Now);
     buildWarningEvent = new BuildWarningEventArgs(null, null, null, 1, 2, 3, 4, null, null, null, DateTime.Now, null);
 }
开发者ID:cameron314,项目名称:msbuild,代码行数:10,代码来源:BuildWarningEventArgs_Tests.cs


示例11: WarningRaised

 void WarningRaised(object sender, BuildWarningEventArgs e)
 {
     string fullPath = ProjectDirectory != null ? Path.Combine(ProjectDirectory, e.File) : e.File;
     Console.ForegroundColor = ConsoleColor.DarkYellow;
     if (e.Code != null)
     {
         Console.WriteLine("{0}({1},{2})  warning:{3}  {4}", fullPath, e.LineNumber, e.ColumnNumber, e.Code, e.Message);
         WarningCount++;
     }
     Console.ForegroundColor = ConsoleColor.White;
 }
开发者ID:fredpointzero,项目名称:UnityBuild,代码行数:11,代码来源:LoggerImpl.cs


示例12: FormatWarningEvent

		public virtual string FormatWarningEvent (BuildWarningEventArgs args)
		{
			StringBuilder sb = new StringBuilder ();

			sb.Append (args.File);
			AppendLineNumbers (sb, args.LineNumber, args.ColumnNumber, args.EndLineNumber, args.EndColumnNumber);
			sb.Append (": ");
			sb.Append (args.Subcategory);
			sb.Append (" warning ");
			sb.Append (args.Code);
			sb.Append (": ");
			sb.Append (args.Message);

			return sb.ToString ();
		}
开发者ID:nlhepler,项目名称:mono,代码行数:15,代码来源:Logger.cs


示例13: SharpBuildWarningEvent

 public SharpBuildWarningEvent(BuildWarningEventArgs arg)
     : base(SharpBuildEventType.WarningLog)
 {
     if (arg != null)
     {
         Code = arg.Code;
         ColumnNumber = arg.ColumnNumber;
         EndColumnNumber = arg.EndColumnNumber;
         EndLineNumber = arg.EndLineNumber;
         File = arg.File;
         LineNumber = arg.LineNumber;
         ProjectFile = arg.ProjectFile;
         Message = arg.Message;
     }
 }
开发者ID:boyd4y,项目名称:sharpbuild,代码行数:15,代码来源:SharpBuildWarningEvent.cs


示例14: LogWarningEvent

        public void LogWarningEvent(BuildWarningEventArgs eventArgs)
        {
            if (eventArgs.File != null && eventArgs.File.Length > 0)
            {
                Console.Write("{0}({1},{2}): ", eventArgs.File, eventArgs.LineNumber, eventArgs.ColumnNumber);
            }

            Console.Write("WARNING " + eventArgs.Code + ": ");
            _log += "WARNING " + eventArgs.Code + ": ";
            ++_warnings;

            Console.WriteLine(eventArgs.Message);
            _log += eventArgs.Message;
            _log += "\n";
        }
开发者ID:cameron314,项目名称:msbuild,代码行数:15,代码来源:MockEngine.cs


示例15: BuildMessage

 public BuildMessage(BuildWarningEventArgs args)
 {
     EventType = args.GetType().Name.Replace("EventArgs", "");
     Code = args.Code;
     ColumnNumber = args.ColumnNumber;
     EndColumnNumber = args.EndColumnNumber;
     EndLineNumber = args.EndLineNumber;
     File = args.File;
     LineNumber = args.LineNumber;
     Message = args.Message;
     ProjectFile = args.ProjectFile;
     Subcategory = args.Subcategory;
     HelpKeyword = args.HelpKeyword;
     SenderName = args.SenderName;
     Timestamp = args.Timestamp;
     ThreadId = args.ThreadId;
 }
开发者ID:perpetual-motion,项目名称:clrplus,代码行数:17,代码来源:Logger.cs


示例16: LogWarning

        private void LogWarning(string value)
        {
            BuildWarningEventArgs warning = new BuildWarningEventArgs(
                subcategory: null,
                code: null,
                file: this.buildEngine.ProjectFileOfTaskNode,
                lineNumber: this.buildEngine.LineNumberOfTaskNode,
                columnNumber: this.buildEngine.ColumnNumberOfTaskNode,
                endLineNumber: 0,
                endColumnNumber: 0,
                message: value,
                helpKeyword: null,
                senderName: this.taskName,
                eventTimestamp: DateTime.UtcNow);

            this.buildEngine.LogWarningEvent(warning);
        }
开发者ID:ramarag,项目名称:XTask,代码行数:17,代码来源:BuildLogger.cs


示例17: LogWarningEvent

        public void LogWarningEvent(BuildWarningEventArgs eventArgs)
        {
            if (eventArgs.File != null && eventArgs.File.Length > 0)
            {
                if (logToConsole)
                    Console.Write("{0}({1},{2}): ", eventArgs.File, eventArgs.LineNumber, eventArgs.ColumnNumber);
                log += String.Format("{0}({1},{2}): ", eventArgs.File, eventArgs.LineNumber, eventArgs.ColumnNumber);
            }

            if (logToConsole)
                Console.Write("WARNING " + eventArgs.Code + ": ");
            log += "WARNING " + eventArgs.Code + ": ";
            ++warnings;

            if (logToConsole)
                Console.WriteLine(eventArgs.Message);
            log += eventArgs.Message;
            log += "\n";
        }
开发者ID:RainsSoft,项目名称:StyleCop,代码行数:19,代码来源:MockBuildEngine.cs


示例18: OutputWarning

 internal override void OutputWarning(object sender, BuildWarningEventArgs e)
 {
     if (GetHeaderOnlyFirstTyme() != null) { logStream.WriteLine(GetHeaderOnlyFirstTyme()); }
     logStream.WriteLine(FormatWarningEvent(e));
 }
开发者ID:Hiroaki-Kubota,项目名称:MSBuildLoggers,代码行数:5,代码来源:TSVFileLogger.cs


示例19: LogWarningFromResource

        /// <summary>
        /// Generates the error event corresponding to a particular resource string and set of args
        /// </summary>
        private void LogWarningFromResource(string messageResource, params object[] messageArgs)
        {
            ErrorUtilities.VerifyThrow(_currentConfiguration != null, "We should never have a null configuration when we're trying to log warnings!");

            // Using the CLR 2 build event because this class is shared between MSBuildTaskHost.exe (CLR2) and MSBuild.exe (CLR4+)
            BuildWarningEventArgs warning = new BuildWarningEventArgs
                                                (
                                                    null,
                                                    null,
                                                    ProjectFileOfTaskNode,
                                                    LineNumberOfTaskNode,
                                                    ColumnNumberOfTaskNode,
                                                    0,
                                                    0,
                                                    ResourceUtilities.FormatString(AssemblyResources.GetString(messageResource), messageArgs),
                                                    null,
                                                    _currentConfiguration.TaskName
                                                );

            LogWarningEvent(warning);
        }
开发者ID:JamesLinus,项目名称:msbuild,代码行数:24,代码来源:OutOfProcTaskHostNode.cs


示例20: OnWarningRaised

 void OnWarningRaised(object sender, BuildWarningEventArgs e)
 {
     TraceSource.TraceEvent(TraceEventType.Warning, 0, e.Message);
 }
开发者ID:willcraftia,项目名称:WindowsGame,代码行数:4,代码来源:BuildLogger.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Framework.CustomBuildEventArgs类代码示例发布时间:2022-05-26
下一篇:
C# Framework.BuildStartedEventArgs类代码示例发布时间: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