Skip to content

Optimization for Azure Pipeline bases on MSBuild. Ready-made script can be added in DevOps Pipeline step. Very useful when you don't have automatic CI/CD.

License

Notifications You must be signed in to change notification settings

damianczer/Azure-DevOps-MSBuild-Auto

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 

Repository files navigation

🚀 Azure DevOps Pipeline Boost

Optimize CI/CD for Legacy Projects Without Docker or Proper CI/CD Configuration

⭐ GitHub stars
👀 GitHub watchers
🐞 GitHub issues


👤 Author

Damian Czerwiński


🛠️ Technology Stack


📝 Overview

This script optimizes CI/CD pipelines by building only the projects that have changed, instead of rebuilding the entire solution. It is especially useful for:

  • Large solutions with 100+ projects
  • Legacy projects without Docker or properly configured CI/CD
  • Reducing build times in Azure DevOps Pipelines

Why Use This Script?

  • Save Time: ⏱️ Reduce build times by up to 20 minutes!
  • Selective Builds: 🛠️ Build only the projects that have changed.
  • Customizable: 🔧 Adaptable to your project structure.
  • Legacy-Friendly: 🏛️ Works even without modern CI/CD tools like Docker.

🛠️ How It Works

  1. Detect Changes: Compares the current branch with the target branch to identify changed files.
  2. Filter Projects: Extracts the list of projects (.csproj) affected by the changes.
  3. Set Variables: Passes the list of changed projects to MSBuild for selective building.

📊 Before vs After

Before:

Building the entire solution, even for small changes.
Before

After:

Building only the changed projects.
After


🛠️ Setup Instructions

  1. Clone the repository.
  2. Configure the script parameters:
    • CompareSourceBranch
    • BranchName
    • Repository
    • TargetBranch
  3. Run the script in your Azure DevOps pipeline.

📦 Pipeline Configuration

Step Configuration:

Step Configuration

Pipeline Variables:

Pipeline Variables

MSBuild Configuration:

MSBuild Configuration


🧩 How to Use MSBuild with This Script

Instead of building the entire solution (.sln), pass the list of changed projects to MSBuild:

<Project>
  <Target Name="Build">
    <MSBuild Projects="$(projects)" />
  </Target>
</Project>

🎉 Enjoy Faster Builds!

If your deployment method allows copying only changed files/projects, this script will save you time and resources.
Don't build the whole solution—build only what has changed!


About

Optimization for Azure Pipeline bases on MSBuild. Ready-made script can be added in DevOps Pipeline step. Very useful when you don't have automatic CI/CD.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published