EventSource Class

MSBuild Extension Pack

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

SystemObject  Microsoft.Build.UtilitiesTask
    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

  NameDescription
Public methodEventSource
Top
Properties

  NameDescription
Public propertyCategoryCount
Sets the number of categories in the category resource file
Public propertyCategoryResourceFile
Sets the path of the category resource file to write events with localized category strings
Public propertyDescription
Sets the description for the logentry
Public propertyEventId
Sets the event id.
Public propertyExists
Gets a value indicating whether the EventSource exists.
Public propertyForce
Set to true to delete any existing matching eventsource when creating
Public propertyLogName
Sets the name of the log the source's entries are written to, e.g Application, Security, System, YOUREVENTLOG.
Public propertyLogType
Sets the Event Log Entry Type. Possible values are: Error, FailureAudit, Information, SuccessAudit, Warning.
Public propertyMessageResourceFile
Sets the path of the message resource file to configure an event log source to write localized event messages
Public propertyParameterResourceFile
Sets the path of the parameter resource file to configure an event log source to write localized event messages with inserted parameter strings
Public propertySource
Sets the source name
Top
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

Reference