If you try to run from the command line in the top directory of a solution made with visual studio:
dotnet build
My solution is architectured like that:
MySolution.sln > src > MyProject1 > project.json > MyProject2 > project.json > test > MyProject.Test > project.json
it will fail with the following error:
Couldn't find 'project.json' in current directory
How could I build the solution without having to specify each project explicitely (and then without the related maintenance) ?
With ASP.NET Core, you can: Build web apps and services, Internet of Things (IoT) apps, and mobile backends. Use your favorite development tools on Windows, macOS, and Linux.
Note: The . NET 5.0 SDK versions will continue to be supported in VS 16.11 until December of 2022 when . NET Core 3.1 goes out of support so that . NET Core 3.1 customers can continue to use 16.11 to developer their applications.
To publish from Visual Studio, do the following: Change the solution configuration from Debug to Release on the toolbar to build a Release (rather than a Debug) version of your app. Right-click on the project (not the solution) in Solution Explorer and select Publish. In the Publish tab, select Publish.
Create a solution file To use the dotnet sln command, the solution file must already exist. If you need to create one, use the dotnet new command with the sln template name.
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.
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 }
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