Build Events allow Dotfuscator to run external programs before or after its build sequence.
Use build events when you need to integrate Dotfuscator with another step in your build process, such as running a script, copying files, or calling an external tool.
Pre-Build Event
A pre-build event runs before Dotfuscator begins processing input assemblies.
Dotfuscator executes the program specified by the pre-build event before it does anything else with the input assemblies.
Post-Build Event
A post-build event runs at the end of the Dotfuscator build process.
You can configure a post-build event to run:
- Only when the build succeeds.
- Only when the build fails.
- Every time the build runs.
You can also configure Dotfuscator to run the post-build event once for the build or once for each output module.
Configure Build Events
To configure build events in the Config Editor:
- Open your Dotfuscator config in the Config Editor.
- Go to Settings tab.
- Open the Build Events option.
- In the Pre-Build Event section, configure the external program for the event.
- If needed, configure the working directory and command-line options.
- Choose whether Dotfuscator should fail the build if the program returns a non-zero error code.
- In the Post-Build Event section, choose when the event should run (Build Successful, Build Fails, Always).
- Configure the program for the event, and the working directory and command-line options if required.
- Indicate whether the post-build event should run on each module.
- Choose whether Dotfuscator should halt the build on failure. Save the config.
Build Event Properties
Dotfuscator exposes properties that you can reference when configuring build events.
| Property Name | Description |
dotf.destination |
Path to the destination directory. |
dotf.inputmap.xml |
Full path and filename to the input map file, if specified. |
dotf.outputmap.xml |
Full path and filename to the output map file, if specified. |
dotf.removal.xml |
Full path and filename to the XML removal file, if specified. |
dotf.config.file |
Full path to the current config file. |
dotf.current.out.module |
Full path to the current output module. Used in the post-build event when the program is called for each output module. |
dotf.current.in.module |
Full path to the current input module. Used in the post-build event when the program is called for each output module. |
You can also reference external properties, environment variables, properties passed on the command line with the -p option, and user-defined config properties in build events.