MultiBuildDotNet is a .NET console app designed to sequentially build multiple .NET
solutions based on a configuration file. The app allows users to specify custom commands (e.g., dotnet build
) to run for each solution and substitutes the solution paths dynamically. It also reads a master build order config file to ensure that solutions are built in the correct order.
- Build multiple .NET solutions in a specified order.
- Supports customizable build commands using placeholders for solution paths.
- Reads a master build order file to ensure the correct order of solutions.
- Compare the latest commits in the current branch and another branch (e.g.,
master
) to find solutions that need rebuilding.
-
Clone the repository:
git clone https://github.com/EntityProcess/MultiBuildDotNet.git cd MultiBuildDotNet
-
Build the console app:
dotnet publish -c Release
-
Create a
config.json
file in the project directory. This file will contain the list of solution file paths and the command template you want to run.Example
config.json
:{ "CommandTemplate": "dotnet build \"{solution}\"", "WorkingDirectory": "C:/path/to/your/repo", "Solutions": [ "C:/Projects/Solution1.sln", "C:/Projects/Solution2.sln" ] }
- Replace
"dotnet build {solution}"
with the desired command. - Use
{solution}
as the placeholder for each solution's path, which will be replaced by the entries in theSolutions
array. - Paths containing backslashes (
\
) inSolutions
will be converted to forward slashes (/
).
- Replace
-
Optionally, create a
masterBuildOrder.json
file in the project directory. This file contains the solutions in the order they should be built:Example
masterBuildOrder.json
:{ "Solutions": [ "C:/Projects/Solution1.sln", "C:/Projects/Solution2.sln" ] }
If
masterBuildOrder.json
exists, the app will reorder the solutions fromconfig.json
based on the master build order specified inmasterBuildOrder.json
. Solutions inconfig.json
that are not found in the master build order will be appended in their original order. -
Run the app:
MultiBuildDotNet.exe
The app will execute the command for each solution sequentially. If a command fails, the process will stop, and the name of the failed solution will be displayed.
-
You can specify two Git commits to find solutions that contain changes between those commits. The app will use the changed solutions between the specified commits, but any solutions in
config.json
that do not appear in the list of changed solutions will also be included in the build process.Example usage with commit hashes:
MultiBuildDotNet.exe <commit1> <commit2>
Example:
MultiBuildDotNet.exe abc123 def456
If no commit arguments are provided, the app will use the existing solutions from
config.json
. -
You can compare the latest commit in the current branch with the latest commit in another branch (e.g., master). The app will rebuild solutions that have changes between these commits.
Example usage with branch comparison:
MultiBuildDotNet.exe -b master
Running command: dotnet build C:/Projects/Solution1.sln
Microsoft (R) Build Engine version 16.9.0+57a23d249 for .NET
...
Running command: dotnet build C:/Projects/Solution2.sln
Microsoft (R) Build Engine version 16.9.0+57a23d249 for .NET
...
Build failed for solution: C:/Projects/Solution2.sln
config.json
: Contains the command template, working directory, and list of solution paths.masterBuildOrder.json
: Contains the solutions in the order they should be built.
{
"CommandTemplate": "dotnet build {solution}",
"WorkingDirectory": "C:/path/to/your/repo",
"Solutions": [
"C:/Projects/Solution1.sln",
"C:/Projects/Solution2.sln"
]
}
- .NET SDK (8.0 or later)
{
"Solutions": [
"C:/Projects/Solution2.sln",
"C:/Projects/Solution1.sln"
]
}
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Feel free to open issues or submit pull requests for improvements and bug fixes.