Open danmoseley opened 1 year ago
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.
This is difficult because of how we integrate with MSBuild here. We pass along any CLI tokens that aren't explicitly recognized by the .NET CLI's restore
command directly through to MSBuild. Since we don't fully model MSBuild's CLI surface area here, we do not know if a token is valid or not, so we have to assume that -interactive
is something that might be useful to MSBuild. It's possible that we could try to look for one-off's of these kinds of token typos/mistakes, but it would IMO be a lot of manual work. If we had a fully-modeled CLI grammar then System.CommandLine would generate typo correction code automatically on our behalf.
As an aside, I've kind of been wanting to try modeling MSBuild's entire grammar with System.CommandLine...
Prompted by the very helpful Nuget error message
Steps:
dotnet restore
with-interactive
, note only one hyphen.Result:
Expected:
Commentary:
Note that
-interactive
(one hyphen) does not give any error, it seems just ignored, whereas passing a made up switch does error:You can see by filtering the output of the build for 'interactive' and comparing one with two hyphens that only the two hyphens version works:
I'm not sure where this bug goes. I see that in some cases, NuGet itself handles
--interactive
eg here. But I think for the restore command, this may be taken care of within the dotnet/sdk repo.version info: