dotnet / sdk

Core functionality needed to create .NET Core projects, that is shared between Visual Studio and CLI
https://dot.net/core
MIT License
2.71k stars 1.06k forks source link

New `--os` argument for `dotnet restore` #37245

Open joegoldman2 opened 11 months ago

joegoldman2 commented 11 months ago

Summary

Currently, the dotnet restore command lacks an option to specify the target operating system directly, similar to the existing options in dotnet build and dotnet publish. I propose the addition of a new argument: --os <OS>.

Motivation

The motivation behind this request is to align the dotnet restore command with the capabilities of dotnet build and dotnet publish, which both support the --os argument. While dotnet restore already has the -r|--runtime option to specify the target runtime identifier, having a dedicated --os argument would provide consistency.

Usage

dotnet restore --os linux

Additional Information

N/A

baronfel commented 11 months ago

totally agree - both the --arch and --os options should be unified across all commands that can take a --runtime argument currently.

@joegoldman2 what version of the SDK did you discover this on?

joegoldman2 commented 11 months ago

I'm using the latest stable version 8.100.0.

baronfel commented 10 months ago

So I was looking into some additional testing for #37429 and realized something -- restore allows multiple --runtime options, so --arch and --os either have reduced utility (meaning they should either not be present here or only contribute part of the full set of runtimes). pack is similar - it only surfaces --runtime from the 'implicit restore' that can happen under the covers. We should make sure that adding --os and --arch works correctly when multiple --runtime options are provided.