.Net Core build a solution

If you arrive here looking for the command to build a SLN with dotnet CLI (version > 3.1), using only CLI args, it's below.

dotnet build <PATH>/<TO>/<SLN_FILE>.sln

https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-build#arguments


.NET Core 1.0 Preview (project.json)

You can use wildcards like that from the top directory (where lies the .sln).

  • With the project.json in SolutionDir/Src/ProjectName:

    dotnet build */**/project.json

  • If project.json in SolutionDir/ProjectName:

    dotnet build **/project.json

Note: It's recommended to migrate to new csproj project format to get support and new features.

Since .NET Core 1.0 RTM

The solution is back for good.

  dotnet build solution.sln

In powershell, build all csproj file under the current directory.

foreach ($csproj in $(Get-ChildItem -Recurse . -Filter *.csproj) )
{
    dotnet build $csproj.FullName
}