Global property "ContinueOnError" with value "true" or "ErrorAndContinue" is not respected causing broken intellisense in DTBB
Global property "ContinueOnError" with value "true" or "ErrorAndContinue" is not respected, causing broken Intellisense in solution loaded with DTBB (design-time build batching) on which is default - all projects are loaded in "Misc Files".
We run these targets for DTBB: "Compile", "CoreCompile", "ResolveReferences", "ResolveProjectReferences", "ResolveAssemblyReferences", "ResolveComReferences", "ResolveNativeReferences", "ResolveSdkReferences", "CollectReferencedNuGetPackages" And pass "ErrorAndContinue" for global property "ContinueOnError".
Expected: It should continue if error occurs.
Actual: MSBuild immediately fails the submission.
So far we've run into two kinds of scenarios that can cause this (see below). If we fix this issue, we can avoid all other potential user scenarios.
-
Target missing Repro: see the repro in this issue https://github.com/Microsoft/msbuild/pull/2764
-
Target fails Repro: user opens a solution the first time when $(IntermediateOutputPath) does not exist:
Target Name=Compile Project=Microsoft.VisualStudio.Workspace.VSIntegration.csproj
Target Name=GenerateAssemblyInfoFile Project=Microsoft.VisualStudio.Workspace.VSIntegration.csproj
WriteCodeFragment
Parameters
AssemblyAttributes
System.Reflection.AssemblyCopyright
_Parameter1 = © Microsoft Corporation. All rights reserved.
System.Reflection.AssemblyProduct
_Parameter1 = Microsoft® Visual Studio®
Language = C#
OutputDirectory = c:\Repos\AnyCode\obj\Debug\Microsoft.VisualStudio.Workspace.VSIntegration
OutputFile = AssemblyInfo.MicroBuild.generated.cs
Errors
C:\Users\hlong.nuget\packages\microbuild\2.0.2-beta\build\MicroBuild.targets(94,5): error MSB3713: The file "c:\Repos\AnyCode\obj\Debug\Microsoft.VisualStudio.Workspace.VSIntegration\AssemblyInfo.MicroBuild.generated.cs" could not be created. Could not find a part of the path 'c:\Repos\AnyCode\obj\Debug\Microsoft.VisualStudio.Workspace.VSIntegration\AssemblyInfo.MicroBuild.generated.cs'. [c:\Repos\AnyCode\src\Microsoft.VisualStudio.Workspace.VSIntegration\Microsoft.VisualStudio.Workspace.VSIntegration.csproj]
@huizhonglong There's no built in support for targets to respect ContinueOnError; it's just a pattern across MSBuild where tasks invocations are supposed to respect the $(ContinueOnError) property if its specified, for example: https://github.com/Microsoft/msbuild/blob/adb180d394176f36aca1cc2eac4455fef564739f/src/Tasks/Microsoft.Common.CurrentVersion.targets#L2145. Any tasks that don't respect it - will break the build if they error.