Yokovaski
Yokovaski

Reputation: 188

Visual Studio 2017: Cancel build in pre build event

I can't seem to find whether it is possible in Visual Studio to cancel a build by checking something in a pre build event. Is this possible? If so: how?

Thanks in advance!

Upvotes: 1

Views: 538

Answers (1)

Yokovaski
Yokovaski

Reputation: 188

I can use exit /b 1. It intentionally causes the pre-build event to fail by setting the %errorlevel% to 1, stopping the build. The error message is not great.

Upvotes: 3

Related Questions