`dotnet completions script` can't complete after `dotnet build a.csproj`
- Dominant language
- C#
- Stars
- 3.2k
- Forks
- 1.3k
- PR merge metrics
- PR metrics pending
Description
### Describe the bug
Using this in my $PROFILE
>dotnet completions script pwsh | Out-String | Invoke-Expression -ErrorAction SilentlyContinue
From https://learn.microsoft.com/en-us/dotnet/core/whats-new/dotnet-10/sdk#native-shell-tab-completion-scripts (Notice the docs say `out-String` but I fixed it to `Out-String` in my script)
```
➜ dotnet build --help
Description:
.NET Builder
Usage:
dotnet build [...] [options]
```
I don't get completions for the options part of `dotnet build`, see repro below (UPDATE: I re-tried with .NET 10.0.300 and .NET 11.0.100-preview4)
UPDATE2: I actually don't get any completions at all but in a folder with no .NET projects I get fully functioning completions
### To Reproduce
```sh
➜ dotnet new console
The template "Console App" was created successfully.
Processing post-creation actions...
Restoring C:\repos\repros\sdk\CompletionNotWorkingAsExpected\CompletionNotWorkingAsExpected.csproj:
Restore succeeded.
Press tab after --no-r to try to get completion here trying to get it to auto-complete --no-restore
➜ dotnet build .\CompletionNotWorkingAsExpected.csproj --no-r
```
### Exceptions (if any)
### Further technical details
details of dotnet --info
.NET SDK:
Version: 10.0.100-preview.7.25380.108
Commit: 30000d883e
Workload version: 10.0.100-manifests.8bb6be96
MSBuild version: 17.15.0-preview-25380-108+30000d883
Runtime Environment:
OS Name: Windows
OS Version: 10.0.19045
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\10.0.100-preview.7.25380.108\
.NET workloads installed:
There are no installed workloads to display.
Configured to use workload sets when installing new manifests.
Workloads are configured to install and update using workload versions, but none were found. Run "dotnet workload restore" to install a workload version.
Host:
Version: 10.0.0-preview.7.25380.108
Architecture: x64
Commit: 30000d883e
.NET SDKs installed:
8.0.413 [C:\Program Files\dotnet\sdk]
9.0.304 [C:\Program Files\dotnet\sdk]
10.0.100-preview.7.25380.108 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 8.0.19 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 10.0.0-preview.7.25380.108 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 8.0.19 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 10.0.0-preview.7.25380.108 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 8.0.19 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 9.0.8 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 10.0.0-preview.7.25380.108 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Other architectures found:
None
Environment variables:
Not set
global.json file:
Not found
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
- The IDE (VS / VS Code/ VS4Mac) you're running on, and its version
N/A
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.