本文整理汇总了C#中Microsoft.Build.Framework.ProjectStartedEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# ProjectStartedEventArgs类的具体用法?C# ProjectStartedEventArgs怎么用?C# ProjectStartedEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ProjectStartedEventArgs类属于Microsoft.Build.Framework命名空间,在下文中一共展示了ProjectStartedEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProjectStarted
void ProjectStarted(object sender, ProjectStartedEventArgs e)
{
string directoryName = Path.GetDirectoryName(e.ProjectFile);
if (null != directoryName)
this.ProjectDirectory = directoryName;
// Console.WriteLine("Project Started: " + e.ProjectFile);
}
示例2: 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);
}
示例3: eventSource_ProjectStarted
void eventSource_ProjectStarted(object sender, ProjectStartedEventArgs e)
{
// ProjectStartedEventArgs adds ProjectFile, TargetNames
// Just the regular message string is good enough here, so just display that.
WriteLine(String.Empty, e);
indent++;
}
示例4: Project
/// <summary>
/// Initializes a new instance of the <see cref="Project"/> class.
/// </summary>
/// <param name="projectId">The project identifier.</param>
/// <param name="e">The <see cref="ProjectStartedEventArgs"/> instance containing the event data.</param>
/// <param name="parentPropertyBag">The parent property bag (to check for inherited properties).</param>
public Project(int projectId, ProjectStartedEventArgs e, PropertyBag parentPropertyBag)
{
Properties = new PropertyBag(parentPropertyBag);
Id = projectId;
TryUpdate(e);
}
示例5: eventSource_ProjectStarted
/// <summary>
/// Handler for the ProjectStarted event.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void eventSource_ProjectStarted(object sender, ProjectStartedEventArgs e)
{
// Clone and store the properties so we can inspect the values later on
foreach (DictionaryEntry property in e.Properties)
{
projectStartedProperties[(string) property.Key] = (string) property.Value;
}
}
示例6: ProjectState
public ProjectState(ProjectStartedEventArgs args)
{
GlobalProperties = args.GlobalProperties;
ProjectFile = args.ProjectFile;
ContextId = args.BuildEventContext.ProjectContextId;
ParentContextId = args.ParentProjectBuildEventContext.ProjectContextId;
TargetPath = (string)args.Properties?.Cast<DictionaryEntry>().FirstOrDefault(p => ((string)p.Key).Equals("TargetPath")).Value;
}
示例7: EventArgsCtors
public void EventArgsCtors()
{
ProjectStartedEventArgs projectStartedEvent = new ProjectStartedEventArgs2();
Assert.IsNotNull(projectStartedEvent);
projectStartedEvent = new ProjectStartedEventArgs("Message", "HelpKeyword", "ProjecFile", "TargetNames", null, null);
projectStartedEvent = new ProjectStartedEventArgs("Message", "HelpKeyword", "ProjecFile", "TargetNames", null, null, DateTime.Now);
projectStartedEvent = new ProjectStartedEventArgs(1, "Message", "HelpKeyword", "ProjecFile", "TargetNames", null, null, null);
projectStartedEvent = new ProjectStartedEventArgs(1, "Message", "HelpKeyword", "ProjecFile", "TargetNames", null, null, null, DateTime.Now);
projectStartedEvent = new ProjectStartedEventArgs(null, null, null, null, null, null);
projectStartedEvent = new ProjectStartedEventArgs(null, null, null, null, null, null, DateTime.Now);
projectStartedEvent = new ProjectStartedEventArgs(1, null, null, null, null, null, null, null);
projectStartedEvent = new ProjectStartedEventArgs(1, null, null, null, null, null, null, null, DateTime.Now);
}
示例8: AssignmentTest
public void AssignmentTest ()
{
ProjectStartedEventArgs psea;
string message = "message";
string helpKeyword = "helpKeyword";
string projectFile = "projectFile";
string targetNames = "targetNames";
string [] properties = new string [2] { "a", "b" };
string [] items = new string [2] { "c", "d" };
psea = new ProjectStartedEventArgs (message, helpKeyword, projectFile, targetNames, properties, items);
Assert.AreEqual (message, psea.Message, "A1");
Assert.AreEqual (helpKeyword, psea.HelpKeyword, "A2");
Assert.AreEqual (projectFile, psea.ProjectFile, "A3");
Assert.AreEqual (targetNames, psea.TargetNames, "A4");
Assert.AreEqual (properties, psea.Properties, "A5");
Assert.AreEqual (items, psea.Items, "A6");
}
示例9: ItemsAndPropertiesDifferentEquals
public void ItemsAndPropertiesDifferentEquals()
{
ArrayList itemsList = new ArrayList();
ArrayList propertiesList = new ArrayList();
ProjectStartedEventArgs differentItemsAndProperties = new ProjectStartedEventArgs
(
s_baseProjectStartedEvent.ProjectId,
s_baseProjectStartedEvent.Message,
s_baseProjectStartedEvent.HelpKeyword,
s_baseProjectStartedEvent.ProjectFile,
s_baseProjectStartedEvent.TargetNames,
propertiesList,
itemsList,
s_baseProjectStartedEvent.ParentProjectBuildEventContext,
s_baseProjectStartedEvent.Timestamp
);
Assert.IsFalse(propertiesList == s_baseProjectStartedEvent.Properties);
Assert.IsFalse(itemsList == s_baseProjectStartedEvent.Items);
}
示例10: eventSource_ProjectStartedHandler
private void eventSource_ProjectStartedHandler(object sender, ProjectStartedEventArgs e)
{
LogStageStarted(XmlLoggerElements.Project, e.TargetNames, e.ProjectFile, e.Timestamp);
}
示例11: ProjectStartedHandler
/// <summary>
/// This is the delegate for ProjectStartedHandler events.
/// </summary>
private void ProjectStartedHandler(object sender, ProjectStartedEventArgs buildEvent)
{
try
{
if (LogAtImportance(MessageImportance.Low))
{
LogEvent(sender, buildEvent);
}
}
catch (Exception e)
{
Debug.Assert(false, "Problem logging projectstarted event: " + e.Message + " at " + e.TargetSite);
// swallow the exception
}
}
示例12: ProjectStarted
private void ProjectStarted(object sender, ProjectStartedEventArgs e)
{
string targets = string.IsNullOrEmpty(e.TargetNames) ? "default" : e.TargetNames;
string line = string.Format(CultureInfo.InvariantCulture, "Project \"{0}\" ({1} target(s)):", e.ProjectFile, targets);
this.WriteLine(line + Environment.NewLine);
if (this.IsVerbosityAtLeast(LoggerVerbosity.Diagnostic))
{
this.WriteLine("Initial Properties:");
SortedDictionary<string, string> sortedProperties = new SortedDictionary<string, string>();
foreach (DictionaryEntry k in e.Properties.Cast<DictionaryEntry>())
{
sortedProperties.Add(k.Key.ToString(), k.Value.ToString());
}
foreach (var p in sortedProperties)
{
bool matched = this.regExRules.Select(s => new Regex(s)).Select(r => r.Match(p.Key)).Any(m => m.Success);
if (matched)
{
this.WriteLine(p.Key + "\t = " + SecureChar.Repeat(p.Value.Length));
}
else
{
this.WriteLine(p.Key + "\t = " + p.Value);
}
}
}
}
示例13: OnProjectStarted
private void OnProjectStarted(object sender, ProjectStartedEventArgs e)
{
_projects.Add(new BuildProjectContextEntry(
e.BuildEventContext.ProjectInstanceId,
e.BuildEventContext.ProjectContextId,
e.ProjectFile,
e.GlobalProperties));
}
示例14: ProjectStarted
/// <summary>
/// Event handler which signals the event.
/// </summary>
private void ProjectStarted(object sender, ProjectStartedEventArgs e)
{
_projectStartedEvent.Set();
}
示例15: eventSource_ProjectStarted
private void eventSource_ProjectStarted(object sender, ProjectStartedEventArgs e)
{
Console.WriteLine("project started: file=\"{0}\"", e.ProjectFile);
}