Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compile multiple dotnet core projects in one step using dotnet cli

Assuming this folder structure

SampleApp         global.json         Src               Web                              project.json                 Startup.cs                 ...             Model                 project.json                 Startup.cs                 ... 

how does one compile both projects using dotnet? (from command line, not in visual studio)

If you run dotnet build at the root folder level you get

Could not find file .. project.json

I can see there is this outstanding enhancement on the CLI repo but that is from Feb2.

Any script would have to take dependencies into account before just blindly calling dotnet on all src sub-folders.

like image 923
wal Avatar asked Apr 12 '16 02:04

wal


2 Answers

The dotnet build command accepts glob patterns. So you can do this:

dotnet build Src/**/project.json 
like image 161
Emerson Soares Avatar answered Sep 28 '22 03:09

Emerson Soares


There's no such a tool yet. Even KoreBuild, the tool that the ASP.NET team uses, goes blindly in each folder and invokes dotnet build/pack.

The nice thing is that dotnet build is now smart enough to not recompile the dependencies if they haven't changed, so that's not a problem anymore.

like image 22
Victor Hurdugaci Avatar answered Sep 28 '22 02:09

Victor Hurdugaci