-
Notifications
You must be signed in to change notification settings - Fork 408
Description
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
- Add a custom target to a project:
<Target Name="BreakDesignTimeBuild" DependsOnTargets="TargetThatDoesNotExistExceptAfterRestoreSucceeds">
</Target>- 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'"