Problem description
When a project in a solution fails to compile, msbuild stops despite the fact it can proceed with unrelated projects, like devenv does.
Steps to reproduce
We need a solution with 3 projects where 2nd depends on 1st, and 3rd is independent and fails to compile. Following is an example of such solution.
Directory contents:
/
- 1.csproj
- 2.csproj
- 3.csproj
- Complete.sln
1.csproj
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<FileUpgradeFlags>
</FileUpgradeFlags>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<OldToolsVersion>2.0</OldToolsVersion>
</PropertyGroup>
<Target Name="Build">
<Message Importance="High" Text="Project 1" />
</Target>
</Project>
2.csproj
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<FileUpgradeFlags>
</FileUpgradeFlags>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<OldToolsVersion>2.0</OldToolsVersion>
</PropertyGroup>
<Target Name="Build">
<Message Importance="High" Text="Project 2" />
</Target>
</Project>
3.csproj
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<FileUpgradeFlags>
</FileUpgradeFlags>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<OldToolsVersion>2.0</OldToolsVersion>
</PropertyGroup>
<Target Name="Build">
<Message Importance="High" Text="Project 3" />
<Error Text="Build failed" />
</Target>
</Project>
Complete.sln
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29709.97
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "1", "1.csproj", "{AA88BE9A-5006-4CCE-8871-A67F413DBADF}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "2", "2.csproj", "{BAF51480-4B90-454A-96F5-E63A05A486EF}"
ProjectSection(ProjectDependencies) = postProject
{AA88BE9A-5006-4CCE-8871-A67F413DBADF} = {AA88BE9A-5006-4CCE-8871-A67F413DBADF}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "3", "3.csproj", "{12C30CFB-7387-4CD2-81D4-87E14209C408}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x86 = Debug|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{AA88BE9A-5006-4CCE-8871-A67F413DBADF}.Debug|x86.ActiveCfg = Debug|x86
{AA88BE9A-5006-4CCE-8871-A67F413DBADF}.Debug|x86.Build.0 = Debug|x86
{BAF51480-4B90-454A-96F5-E63A05A486EF}.Debug|x86.ActiveCfg = Debug|x86
{BAF51480-4B90-454A-96F5-E63A05A486EF}.Debug|x86.Build.0 = Debug|x86
{12C30CFB-7387-4CD2-81D4-87E14209C408}.Debug|x86.ActiveCfg = Debug|x86
{12C30CFB-7387-4CD2-81D4-87E14209C408}.Debug|x86.Build.0 = Debug|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {75E95C15-489D-4D3F-82CA-735FB7B88910}
EndGlobalSection
EndGlobal
Command line
msbuild Complete.sln /p:Configuration=Debug /p:Platform=x86 /m
Expected behavior
Compiles projects 1 and 2, fails project 3.
Relevant part of output from devenv:
1>------ Build started: Project: 1, Configuration: Debug x86 ------
2>------ Build started: Project: 3, Configuration: Debug x86 ------
1> Project 1
2> Project 3
2>C:\temp\msbuild\TestSolution\Complete\3.csproj(11,2): error : Build failed
3>------ Build started: Project: 2, Configuration: Debug x86 ------
3> Project 2
========== Build: 2 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Actual behavior
Compiles projects 1, fails project 3. Project 2 isn't touched.
Relevant part of output from msbuild:
Build started 23.01.2020 11:10:38.
1>Project "c:\temp\msbuild\TestSolution\Complete\Complete.sln" on node 1 (default targets).
1>ValidateSolutionConfiguration:
Building solution configuration "Debug|x86".
1>Project "c:\temp\msbuild\TestSolution\Complete\Complete.sln" (1) is building "c:\temp\msbuild\TestSolution\Complete\1.cs
proj" (2) on node 1 (default targets).
2>Build:
Project 1
2>Done Building Project "c:\temp\msbuild\TestSolution\Complete\1.csproj" (default targets).
1>Project "c:\temp\msbuild\TestSolution\Complete\Complete.sln" (1) is building "c:\temp\msbuild\TestSolution\Complete\3.cs
proj" (3) on node 2 (default targets).
3>Build:
Project 3
3>c:\temp\msbuild\TestSolution\Complete\3.csproj(11,5): error : Build failed
3>Done Building Project "c:\temp\msbuild\TestSolution\Complete\3.csproj" (default targets) -- FAILED.
1>Done Building Project "c:\temp\msbuild\TestSolution\Complete\Complete.sln" (default targets) -- FAILED.
Build FAILED.
Environment data
msbuild /version output:
Microsoft (R) Build Engine version 16.4.0+e901037fe for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
16.4.0.56107
devenv: Microsoft Visual Studio 2019 Version 16.4.3
OS info: Windows 10
Related
Probably #3366
My question on StackOverflow: https://stackoverflow.com/questions/59876630/how-to-make-msbuild-to-not-stop-on-error-on-net-solution/59892250
Problem description
When a project in a solution fails to compile,
msbuildstops despite the fact it can proceed with unrelated projects, likedevenvdoes.Steps to reproduce
We need a solution with 3 projects where 2nd depends on 1st, and 3rd is independent and fails to compile. Following is an example of such solution.
Directory contents:
1.csproj
2.csproj
3.csproj
Complete.sln
Command line
Expected behavior
Compiles projects 1 and 2, fails project 3.
Relevant part of output from devenv:
Actual behavior
Compiles projects 1, fails project 3. Project 2 isn't touched.
Relevant part of output from msbuild:
Environment data
msbuild /versionoutput:devenv: Microsoft Visual Studio 2019 Version 16.4.3
OS info: Windows 10
Related
Probably #3366
My question on StackOverflow: https://stackoverflow.com/questions/59876630/how-to-make-msbuild-to-not-stop-on-error-on-net-solution/59892250