Can I somehow build multiple projects with one root project.json
file (or otherwise)? For example, one library, one test project, and one command line? If so, how?
I may be one year late in answering, but may be it is still useful for somebody who lands here after this.
dotnet build no longer uses project.json, instead uses *.csproj. And dotnet build can now take a directory name as an argument, and uses the *.csproj within that directory for the build. This being the case, the easiest way to build from a top-level-directory goes like this:
Assuming the structure of your projects is:
src
|
+ -- proj1
|
+ -- proj2
|
+ -- proj3
|
.
.
Just go to the top-level directory (src
in this case), and type this:
Get-ChildItem -exclude ".vscode" | %{Write-Host -ForegroundColor DarkMagenta "Building $_..."; dotnet build $_;}
I normally use PowerShell within VSCode, and hence you see the -exclude ".vscode"
and PowerShell commands Get-ChildItem
(aliased also as simply 'dir
') and Write-Host
.
Hope this helps.
If all of your projects are stored in a structure like this :
<root>/src/Project1
<root>/src/Project2
then you can use a single command with a globbing pattern to build all of the projects at once:
dotnet build src/**/project.json
From what I am aware of, you'll still need individual project.json files for each project though.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With