Visual Studio add pre-build event that always runs (C# project)

Here’s the solution. Define this property in your project file:

<PropertyGroup>
    <DisableFastUpToDateCheck>true</DisableFastUpToDateCheck>
</PropertyGroup> 

PreBuildStep will then execute every time, regardless of whether the project is or isn’t up to date.

It seems that Visual Studio is bypassing normal up-to-date checks of MSBuild and using some sort of custom check that is faster, but has a side effect of breaking customized build targets.

Leave a Comment