A private build is a way to automate the local testing of the application and should always be run prior to a commit. Using the same script in your continuous integration pipeline, such as an Azure DevOps Pipeline, brings consistency and confidence that CI build will succeed if the local one did.

The main purpose of doing the private build locally is to prevent the loss of 20-30 minutes if a commit causes a continuous integration build to fail.  For 5 reasons why you should be using private builds, see this post.

The purpose of the private build is to prevent the loss of a cycle if a commit causes a continuous integration build to fail

Jeffery Palermo

The private build is not just building locally, but doing a clean build and running tests.  A private build should do the following:

  • Create a totally clean build environment.
  • Compile the all the code at once
  • Setup the test environment, including a small set of sample data.
  • Run unit tests
  • Run fast integration tests.  The local private build should try to run as much as possible without being so long as to bog down the developer (e.g. simple queries, REST calls, etc.) 

The build script can be written in various make derivatives such as psake, cake, fake, etc.  Whatever method you chose ideally there should be as much reuse as possible with the build on the developer’s machine and the one in CI.  Doing so will help you benefit from David’s 
Top 5

Links

Top 5 Reasons a Private Build Should Run Before a Commit

Using psake for Private and Integrated Builds