Compile multiple dotnet core projects in one step using dotnet cli

wal picture wal · Apr 12, 2016 · Viewed 13.8k times · Source

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.

Answer

Emerson Soares picture Emerson Soares · Jul 7, 2016

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

dotnet build Src/**/project.json