dotnet / dotnet/msbuild

[Feature Request]: Warns a user if they use Restore as an explicit target (/t:Restore;Build) instead of the /restore flag

Open
#9,690 2 comments 2 reactions 0 assignees View on GitHub
backlog Feature Request Feature: Warning Waves Priority:2 triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 8h
Merged PRs (30d)
141

Description

### Summary

We should warn users when they use the Restore target specifically (`-t:Restore`) instead of `/restore` during a build - this is _very often_ a mistake and we should point users to the correct version.

### Background and Motivation

Users of the new CLI-based MSBuild property/item syntax often run into issues with uninitialized repositories, so they add `-t:Restore` and then wonder why their tooling only works after the first run. This is the core reason, and we should guide them to using the switch.

### Proposed Feature

When

* Restore is part of the targets list, and
* a project contains NuGet packages, and
* a nuget dependency file was created during the build
* then issue a warning so the user knows they should use /restore instead of /t:Restore

### Alternative Designs

_No response_

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.