Project 10: Advanced MSBuild Customization

You will extend a Visual Studio C++ project file (.vcxproj) to include a custom build step. This step will run after a successful build and will automatically zip the build output and copy it to a designated “deployment” folder.

Quick Reference

Attribute Value
Primary Language MSBuild (XML)
Alternative Languages PowerShell or Batch for scripts
Difficulty Level 3: Advanced
Time Estimate 1-2 weeks
Knowledge Area Build Systems
Tooling MSBuild
Prerequisites Familiarity with Visual Studio projects and XML.

What You Will Build

You will extend a Visual Studio C++ project file (.vcxproj) to include a custom build step. This step will run after a successful build and will automatically zip the build output and copy it to a designated “deployment” folder.

Why It Matters

This project builds core skills that appear repeatedly in real-world systems and tooling.

Core Challenges

  • Editing .vcxproj files → maps to understanding the XML structure of MSBuild projects
  • Defining custom Targets → maps to creating your own build actions
  • Using AfterTargets to control execution order → maps to hooking your custom logic into the standard build process
  • Using MSBuild properties and items → maps to accessing build variables like $(OutDir) and $(TargetName)
  • Executing external commands → maps to using the <Exec> task to run PowerShell or 7z.exe

Key Concepts

Real-World Outcome

... 
  my_app.vcxproj -> C:\Users\douglas\source\repos\my_app\x64\Debug\my_app.exe
  Running custom deployment step...
  Zipping output to C:\deploy\my_app-Debug.zip
  Deployment complete.

Implementation Guide

  1. Reproduce the simplest happy-path scenario.
  2. Build the smallest working version of the core feature.
  3. Add input validation and error handling.
  4. Add instrumentation/logging to confirm behavior.
  5. Refactor into clean modules with tests.

Milestones

  • Milestone 1: Minimal working program that runs end-to-end.
  • Milestone 2: Correct outputs for typical inputs.
  • Milestone 3: Robust handling of edge cases.
  • Milestone 4: Clean structure and documented usage.

Validation Checklist

  • Output matches the real-world outcome example
  • Handles invalid inputs safely
  • Provides clear errors and exit codes
  • Repeatable results across runs

References

  • Main guide: LEARN_WINDOWS_SYSTEMS_PROGRAMMING_CPP.md
  • “MSBuild Trickery” by Mike Stall (online blog series)