dotnet / install-scripts

MIT License
127 stars 70 forks source link

`install-dotnet.ps1` is too verbose without way to quiet it #351

Closed RussKie closed 1 year ago

RussKie commented 1 year ago

My global.json looks like this

{
  "sdk": {
    "version": "8.0.100-preview.2.23115.11"
  },
  "tools": {
    "dotnet": "8.0.100-preview.2.23115.11",
    "runtimes": {
      "dotnet/x64": [
        "3.1.32",
        "6.0.13",
        "7.0.2"
      ],
      "aspnetcore/x64": [
        "3.1.32",
        "6.0.13",
        "7.0.2"
      ]
    }
  }
}

And when I restore the toolset (essentially invoking install-dotnet.ps1 under covers) the output is too verbose: image

And there's no way to suppress this notification: https://github.com/dotnet/install-scripts/blob/590932815dc4104e9bec3fa517e247b07b7792ac/src/dotnet-install.ps1#L1113-L1116 https://github.com/dotnet/install-scripts/blob/590932815dc4104e9bec3fa517e247b07b7792ac/src/dotnet-install.ps1#L125-L133

I'd like to be able to disable this notification. Perhaps, the only information could be valuable (~ironically, the most important part of it's missing in Attempting to install dotnet from public location.~ this is the Arcade SDK's doing) is something like this:

dotnet-install: .NET Core Runtime with version '3.1.32' is already installed.
dotnet-install: .NET Core Runtime with version '6.0.13' is already installed.
dotnet-install: .NET Core Runtime with version '7.0.2' is already installed.
dotnet-install: ASP.NET Core Runtime with version '3.1.32' is already installed.
dotnet-install: ASP.NET Core Runtime with version '6.0.13' is already installed.
dotnet-install: ASP.NET Core Runtime with version '7.0.2' is already installed.

I'd venture to say that emitting this text by default we're wasting millions of hours of compute. This notification should be in the docs and shown when -help is invoked.

MichalPavlik commented 1 year ago

Hello Igor and thanks for contacting us. I guess this text is intended to inform users that this script is really meant to be only for CI environment. @baronfel, we have few options here.

1) Log these messages as "verbose", but users will not be informed about "unexpected" behavior. 2) Add parameter that would disable writing this info. 3) Something else :)

What do you think?

RussKie commented 1 year ago
  1. Log these messages as "verbose", but users will not be informed about "unexpected" behavior.

I'd like to think our users sufficiently intelligent to be able to read the docs or call Get-Help dotnet-install.ps1 to find out the script's purpose. To me the fact that users are using this script is an indication they are aware what they are doing. Else - see the step one :) I'm finding it a bigger issue that we're needlessly consuming compute and emitting console noise.

MichalPavlik commented 1 year ago

Our users are intelligent, but it happens that this script is used outside CI which brings some "oddities" like lifetime of updated environment variable :) We still have to deal with questions, why the dotnet doesn't work when installed this way.

@baronfel, what modification would you prefer?

baronfel commented 1 year ago

We should get a bit more clarity on who mostly uses this script. The majority as far as I know are:

None of these are 'interactive', and all accept the contract of knowing the PATH has been updated. I think this is a pretty strong case for reducing the verbosity at this point (or at least allowing a flag, which Say-Verbose I think handles currently).

That said, this is not a high priority for the team to do given other commitments for .NET 8 at this time. This falls squarely in the 'if contributed we'd be happy to merge' category.