Dotfuscator User's Guide
EventList Section

The eventlist section allows you to specify pre and post build events. For more information about Dotfuscator’s build events, see Build Events.

The eventlist section is optional.

<event> Element

An event is essentially a program that Dotfuscator runs at a particular point in its build sequence. You can specify the program name, working directory, and command line arguments. In addition, an event can support additional configuration settings using an <option> element.

An <event> element has a type attribute. Currently Dotfuscator understands two event types: prebuild and postbuild. The program to run is specified using a <program> element.

Event <program> Element

The program to run when an event occurs is specified with the <program> element. It contains a <file> element specifying the program and its location, as well as an <environment> element that specifies command line arguments and working directory.

Like files and directories, the commandline attribute can contain property macros.

Property Macros
Copy Code
      <program>
        <file dir="c\temp" name="copyfiles.bat" />
        <environment commandline="${myproperty}" workingdir="c:\temp" />
      </program>

Pre-Build Event Options

The pre-build event supports one option that can be set using an <option> element nested within the <event> element for the pre build event.

Option  
haltonfail If the build event program returns a non-zero error code, halt the Dotfuscator build.

Post-Build Event Options

The post-build event supports several options that can be set using an <option> element nested within the <event> element for the post build event.

Option  
haltonfail If the build event program returns a non-zero error code, halt the Dotfuscator build.
runoneachmodule Run the post build event once for each output module.
always Run the post build event all the time, regardless of the success or failure of the Dotfuscator build.
buildfails Run the post build event only when the Dotfuscator build fails.
buildsuccessful Run the post build event only when the Dotfuscator build is successful.

Example

The following example shows an XML configuration file fragment that sets up pre- and post-build events. The pre-build event executes the program c:\temp\copyfiles.bat with no arguments. If the build is successful, then the post-build event executes the program PEVerify on each output assembly. Notice that the output assembly name is passed as a property to PEVerify.

Example XML Configuration File Fragment
Copy Code
  <eventlist>
    <event type="prebuild">
      <program>
        <file dir="c\temp" name="copyfiles.bat" />
        <environment commandline="" workingdir="c:\temp" />
      </program>
    </event>
    <event type="postbuild">
      <option>runoneachmodule</option>
      <option>haltonfail</option>
      <program>
        <file dir="C:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\Bin" name="PEVerify.exe" />
        <environment commandline="${dotf.current.out.module}"
                     workingdir="${dotf.destination}" />
      </program>
    </event>
  </eventlist>
 
See Also

Advanced Topics

 

 


© 2016 PreEmptive Solutions, LLC. All Rights Reserved.

www.preemptive.com