dotnet / msbuild

The Microsoft Build Engine (MSBuild) is the build platform for .NET and Visual Studio.
https://docs.microsoft.com/visualstudio/msbuild/msbuild
MIT License
5.2k stars 1.35k forks source link

[Feature Request]: Add ability to build multiple projects on the command line without sln or slnf #9714

Open LostTime76 opened 6 months ago

LostTime76 commented 6 months ago

Summary

I would like to know the background story of why this is not possible to do today and figured I would ask if it was possible to make this happen.

Background and Motivation

Solution files...................

Today I can build multiple projects with dotnet build by passing in a solution or solution filter to specify the projects I want to build. Additionally, I have the ability to build a single project without a sln or slnf by passing in the name of the project directly. Therefore, it seems like there is no limitation on building multiple projects in a single dotnet build call.

The only reason I have had to create solution files is so that I can have the ability to build multiple related projects at a time. That's it, they do nothing more and they clutter the file tree. Recently, I have had to be able to 'select' individual projects or groups of projects to build within a file tree. This has led me to solution filters, which feel like a cludge over already crusty solution files.

Furthermore, I can invoke the MSBuild task within a project file and pass to it an item list of projects to build! This further solidifies my belief that there is no limitation of building without solution files.

Proposed Feature

Add the ability to pass a list of projects to the dotnet cli / msbuild cli to build without a solution file instead of being limited by a single project input. I think this would get rid of the requirement for many people to need solution files. It can make build automation and selecting the projects to build much easier by allowing them just to be specified on the command line directly.

Proposal(s):

  1. Allow the user to specify multiple project paths on the command line in the invocation. This would just be an extended feature of the existing command line.
  2. If (1) is not possible, provide a new command line option for specifying multiple projects. The 'how' is not important. Could be a single option delimited by a special character or a repeated option such as: "-proj proj1path.proj -proj proj2path.proj"

Alternative Designs

No response

naeemaei commented 6 months ago

Can I work on this feature?

baronfel commented 5 months ago

This seems like a logical and natural extension of the existing MSBuild CLI Grammar - we'd love to see a pull request in this space!

There are a few things to think about here:

Useful links

baronfel commented 3 months ago

@naeemaei I realized I forgot to @ you directly - if you'd like to contribute this feature we'd love to help you implement it!

naeemaei commented 3 months ago

@baronfel Yes, I'd like to contribute.

zivkan commented 1 month ago

This issue has label gathering-feedback, so if there's any specific feedback you'd like, please let me know. In short, I feel being able to pass multiple projects to a single CLI invocation and have it automatically do a P2P traversal (something that I think does not happen with slnf files) would help simplify CI scripts for my complex and multi-pipeline product.

baronfel commented 1 month ago

No feedback required at this point, just need to do the work.

I have talked to other teams like DevKit and it would help their story for not needing to generate a solution file to enable builds in repos that don't have them.