2008-10-02 5 views

답변

7

기본 Task 클래스는 사용할 수있는 Log 속성이 있습니다 편의상 확장 방법으로

1

, 내가 헬퍼 클래스 주위 로거를 포장

public static void Log(ITask task, string message, MessageImportance importance) 
{ 
    try 
    { 
     BuildMessageEventArgs args = new BuildMessageEventArgs(message, string.Empty, 
      task.ToString(), importance); 
     task.BuildEngine.LogMessageEvent(args); 
    } 
    catch (NullReferenceException) 
    { 
     // Don't throw as task and BuildEngine will be null in unit test. 
    } 
} 

요즘 내가 아마 변환 것 :

관련 문제