Documentation

Documentation
V5 Documentation

Run Post-Build Events / Run Pre-Build Events

Project-level NCrunch configuration settings Default Values: false
ID/Tag in config file: RunPostBuildEvents, RunPreBuildEvents

Purpose

These settings allow the suppression of the pre and post build steps normally executed as part of a project build.

By default, pre and post build steps are disabled. This is because in the majority of situations, these steps involve processes that are not required in the building of a test environment for NCrunch.

Limitations

These settings will only override build steps that are declared using the PreBuildEvent and PostBuildEvent properties as defined inside PropertyGroups declared in project file XML. They will not override build steps that are declared using custom build targets, such as BeforeBuild and AfterBuild.

Under .NET Core and .NET Standard, the PreBuildEvent and PostBuildEvent properties do not exist. These properties have instead been replaced with target overrides. As such, these configuration settings will have no effect on .NET Core and .NET Standard projects.

Recommendations

Turning on these options will allow NCrunch to execute the custom pre and post build steps that can be specified for a project.

Where these settings are unavailable (for example, when using custom build targets or when under .NET Core), it is possible to instead suppress build steps by using the $(NCrunch) environment variable inside the build. For example:

<Target Name="MyPreCompileTarget" BeforeTargets="Build" Condition="'$(NCrunch)' != '1'">
  <Exec Command="DoSomething.cmd"/>
</Target>

Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download