How I Develop: Build script

In Development by PaulLeave a Comment

When I start working on a new project, I usually just start in Visual Studio. But before too long, I add a “build script” that:

  • Makes it easier to do the boring and repetitive stuff. Building everything, testing everything, etc.
  • Helps me avoid random issues: forgetting to add something to source control, incremental build issues, etc.

You can see the latest incarnation of this in the BrickUtilities project. It is a PowerShell script that can do the following (among other things):

  • Clean: Delete all generated/built files. Throw an error if there’s a file that didn’t make it into source control.
  • Full: Do “Clean”. Then build all the code and run all the tests.
  • Official: Do “Build”. Then copy the generated files to a “drop” directory. Then increment version number and save it in source control.

Once I have a script like that, here’s how I develop:

  1. Make additions/edits in Visual Studio. Run tests in Visual Studio.
  2. Run “Full” using the script to make sure everything builds and works successfully. If not, go back to #1.
  3. Add changes to source control. If I want to add more to this version, I go back to #1.
  4. Run “Official” using the script to make an official build. Publish new files to NuGet, etc.
  5. Go back to #1 to start working on code for the next version.
Share:

Leave a Comment