Skip to content

A failed design-time build is not reported to the user and can cause errors during build that are confusing #8318

@jeffkl

Description

@jeffkl

Visual Studio Version

Any

Summary

A user can add a custom target to do something during their build. However, most users do not realize they need to exclude their target during design-time builds. A failing design-time build gives NuGet an incomplete nomination and so restore will succeed even though the design-time build failed. There's nothing bubbled up to the user as to what happened so generally users blame NuGet for not restoring.

Steps to Reproduce

  1. Add a custom target to a project:
  <Target Name="BreakDesignTimeBuild" DependsOnTargets="TargetThatDoesNotExistExceptAfterRestoreSucceeds">
  </Target>
  1. Load project in Visual Studio for the first time

Expected Behavior

Visual Studio/Project System should notify the user that the design-time build failed and possibly tell NuGet about it in the nomination details. Or perhaps nomination/restore should not take place until the design-time build targets succeed.

Actual Behavior

Projects load, restore succeeds, but build errors occur.

User Impact

Any user who adds custom targets that break design time build is affected. At least two customers have reported this issue in the last three months.

Workaround

Users who add custom targets should condition them so they don't affect design-time builds:

Condition="'$(DesignTimeBuild)' != 'true'"

Metadata

Metadata

Assignees

Labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions