Closed derekpiasecki closed 6 months ago
No actual build is invoked for projects that are accelerated. If you have post-build steps that need to run on every build that a project is part of, disable build acceleration for the project.
It's not feasible for VS to invoke arbitrary build targets when acceleration occurs. Doing so requires invoking MSBuild, which is the very thing that BA tries to avoid. If you need build logic, it's better to just disable BA.
Note that in general, if your post-build steps are just copying files around, then you can model that in a way that does support BA. However, if you have post-build steps that perform packaging and such, then you'll need to ensure they run by disabling BA.
Visual Studio Version
17.9.3
Summary
When Build Acceleration remember files to copy and does so instead of building, the PostBuild event does not run. Since PostBuild is supposed to happen after the build, and Build Acceleration is part of the build, any actions by Build Acceleration should count as "building" and therefor trigger PostBuild.
Steps to Reproduce
<None Include="somefile.ext" CopyToOutputDirectory="PreserveNewest" />
, but any similar file copy should encounter the same issue.touch
the file).Expected Behavior
Accelerated builds are still builds, so a PostBuild step should still run when an accelerated build completes (with no changes other than the accelerated steps, like file copies). However, this might need to be optional since some projects may have PostBuild steps that in-place modify the project's output files and thus should not be run unless the project does an actual build. Perhaps a new option such as
<RunPostBuildEvent>OnBuildSuccessNotAcceleration</RunPostBuildEvent>
could be used to optionally disable this behavior (or perhaps the inverse,OnBuildSuccessOrAcceleration
).Actual Behavior
When a build completes via BuildAcceleration, this does not trigger the PostBuild step.
User Impact
The main problems are that skipping the PostBuild is not the expected behavior and that it is not obvious that a problem has occurred, since the missing PostBuild step can be hard to recognize for some projects and it will only be missing for some builds (i.e. those that are accelerated). A fairly minor secondary impact is that there is no good workaround other than turning off BuildAcceleration, since manually marking files for the up-to-date check does not have the desired effect.