'specify build order for dependent projects

I have a solution (.sln) with two projects (.csproj). One is the main project, one is a test project. The test project references the main project in its .csproj like so:

<ItemGroup>
    <ProjectReference Include="..\mainProject\mainProject.csproj" />
</ItemGroup>

When I run dotnet build on the solution folder in Visual Studio Code, the fact that the test project depends on the main project is not considered - the two projects are built concurrently. So I get errors.

How can I specify a build order, and where?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source