dotnet / dotnet/project-system

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

Open
#8,318 13 comments 7 reactions 1 assignee Claimed by @drewnoakes View on GitHub
Bug Bash Intern Friendly Triage-Approved
Dominant language
C#
Stars
1k
Forks
415
PR merge metrics
No merged PRs in 30d

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

1. Add a custom target to a project:
```xml


```
2. 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:
```xml
Condition="'$(DesignTimeBuild)' != 'true'"
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.