EventSource Class | MSBuild Extension Pack Help 4.0.12.0 |
Valid TaskActions are:
CheckExists (Required: Source Optional: MachineName Output: Exists)
Create (Required: Source, LogName Optional: Force, MachineName, CategoryCount, MessageResourceFile, CategoryResourceFile, ParameterResourceFile)
Delete (Required: Source Optional: MachineName)
Log (Required: Source, Description, LogType, EventId, LogNameOptional: MachineName)
Remote Execution Support: Yes
Inheritance Hierarchy
MSBuild.ExtensionPackBaseTask
MSBuild.ExtensionPack.ComputerEventSource
Namespace: MSBuild.ExtensionPack.Computer
Assembly: MSBuild.ExtensionPack (in MSBuild.ExtensionPack.dll) Version: 4.0.0.0
The EventSource type exposes the following members.
Constructors
Name | Description | |
---|---|---|
EventSource |
Properties
Name | Description | |
---|---|---|
CategoryCount |
Sets the number of categories in the category resource file
| |
CategoryResourceFile |
Sets the path of the category resource file to write events with localized category strings
| |
Description |
Sets the description for the logentry
| |
EventId |
Sets the event id.
| |
Exists |
Gets a value indicating whether the EventSource exists.
| |
Force |
Set to true to delete any existing matching eventsource when creating
| |
LogName |
Sets the name of the log the source's entries are written to, e.g Application, Security, System, YOUREVENTLOG.
| |
LogType |
Sets the Event Log Entry Type. Possible values are: Error, FailureAudit, Information, SuccessAudit, Warning.
| |
MessageResourceFile |
Sets the path of the message resource file to configure an event log source to write localized event messages
| |
ParameterResourceFile |
Sets the path of the parameter resource file to configure an event log source to write localized event messages with inserted parameter strings
| |
Source |
Sets the source name
|
Examples
<Project ToolsVersion="4.0" DefaultTargets="Default" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <TPath>$(MSBuildProjectDirectory)\..\MSBuild.ExtensionPack.tasks</TPath> <TPath Condition="Exists('$(MSBuildProjectDirectory)\..\..\Common\MSBuild.ExtensionPack.tasks')">$(MSBuildProjectDirectory)\..\..\Common\MSBuild.ExtensionPack.tasks</TPath> </PropertyGroup> <Import Project="$(TPath)"/> <Target Name="Default"> <!-- Delete an event source --> <MSBuild.ExtensionPack.Computer.EventSource TaskAction="Delete" Source="MyEventSource" LogName="Application"/> <!-- Check an event source exists --> <MSBuild.ExtensionPack.Computer.EventSource TaskAction="CheckExists" Source="MyEventSource" LogName="Application"> <Output TaskParameter="Exists" PropertyName="DoesExist"/> </MSBuild.ExtensionPack.Computer.EventSource> <Message Text="Exists: $(DoesExist)"/> <!-- Create an event source --> <MSBuild.ExtensionPack.Computer.EventSource TaskAction="Create" Source="MyEventSource" LogName="Application"/> <MSBuild.ExtensionPack.Computer.EventSource TaskAction="CheckExists" Source="MyEventSource" LogName="Application"> <Output TaskParameter="Exists" PropertyName="DoesExist"/> </MSBuild.ExtensionPack.Computer.EventSource> <Message Text="Exists: $(DoesExist)"/> <!-- Log an event --> <MSBuild.ExtensionPack.Computer.EventSource TaskAction="Log" Source="MyEventSource" Description="Hello" LogType="Information" EventId="222"/> </Target> </Project>
See Also