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.67k stars 1.06k forks source link

"You must install .NET to run this application" #43670

Open Spongman opened 2 days ago

Spongman commented 2 days ago

Description

all the other issues realted to this error message are either closed, or contain irrelevant information.

this is a trivial repro case that shows that the scripted dotnet sdk install is fundamentally broken.

Reproduction Steps

run a rocky9 docker container:

docker run -it rockylinux:9 /bin/bash

in the container's bash prompt, run the following commands:

dnf install -qy libicu                              # required library
curl -s https://dotnet.microsoft.com/download/dotnet/scripts/v1/dotnet-install.sh | bash # install dotnet sdk
export PATH=$PATH:$HOME/.dotnet:$HOME/.dotnet/tools # add dotnet and tools to path
dotnet --info
dotnet tool install --global dotnet-outdated-tool   # install a tool
dotnet tool list --global                           # demonstrate that it's installed correctly
dotnet-outdated                                     # attempt to run it

this will install the latest dotnet SDK, install a command (dotnet-outdated-tool), and attempt to run it.

the entire output is:


Importing GPG key 0x350D275D:
 Userid     : "Rocky Enterprise Software Foundation - Release key 2022 <releng@rockylinux.org>"
 Fingerprint: 21CB 256A E16F C54C 6E65 2949 702D 426D 350D 275D
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9

Installed:
  libicu-67.1-9.el9.x86_64

dotnet-install: Attempting to download using aka.ms link https://dotnetcli.azureedge.net/dotnet/Sdk/8.0.401/dotnet-sdk-8.0.401-linux-x64.tar.gz
dotnet-install: Remote file https://dotnetcli.azureedge.net/dotnet/Sdk/8.0.401/dotnet-sdk-8.0.401-linux-x64.tar.gz size is 211866896 bytes.
dotnet-install: Extracting archive from https://dotnetcli.azureedge.net/dotnet/Sdk/8.0.401/dotnet-sdk-8.0.401-linux-x64.tar.gz
dotnet-install: Downloaded file size is 211866896 bytes.
dotnet-install: The remote and local file sizes are equal.
dotnet-install: Installed version is 8.0.401
dotnet-install: Adding to current process PATH: `/root/.dotnet`. Note: This change will be visible only when sourcing script.
dotnet-install: Note that the script does not resolve dependencies during installation.
dotnet-install: To check the list of dependencies, go to https://learn.microsoft.com/dotnet/core/install, select your operating system and check the "Dependencies" section.
dotnet-install: Installation finished successfully.
.NET SDK:
 Version:           8.0.401
 Commit:            811edcc344
 Workload version:  8.0.400-manifests.b6724b7a
 MSBuild version:   17.11.4+37eb419ad

Runtime Environment:
 OS Name:     rocky
 OS Version:  9.3
 OS Platform: Linux
 RID:         linux-x64
 Base Path:   /root/.dotnet/sdk/8.0.401/

.NET workloads installed:
Configured to use loose manifests when installing new manifests.
There are no installed workloads to display.

Host:
  Version:      8.0.8
  Architecture: x64
  Commit:       08338fcaa5

.NET SDKs installed:
  8.0.401 [/root/.dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 8.0.8 [/root/.dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 8.0.8 [/root/.dotnet/shared/Microsoft.NETCore.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

Welcome to .NET 8.0!
---------------------
SDK Version: 8.0.401

Telemetry
---------
The .NET tools collect usage data in order to help us improve your experience. It is collected by Microsoft and shared with the community. You can opt-out of telemetry by setting the DOTNET_CLI_TELEMETRY_OPTOUT environment variable to '1' or 'true' using your favorite shell.

Read more about .NET CLI Tools telemetry: https://aka.ms/dotnet-cli-telemetry

----------------
Installed an ASP.NET Core HTTPS development certificate.
To trust the certificate, view the instructions: https://aka.ms/dotnet-https-linux

----------------
Write your first app: https://aka.ms/dotnet-hello-world
Find out what's new: https://aka.ms/dotnet-whats-new
Explore documentation: https://aka.ms/dotnet-docs
Report issues and find source on GitHub: https://github.com/dotnet/core
Use 'dotnet --help' to see available commands or visit: https://aka.ms/dotnet-cli
--------------------------------------------------------------------------------------
You can invoke the tool using the following command: dotnet-outdated
Tool 'dotnet-outdated-tool' (version '4.6.4') was successfully installed.
Package Id                Version      Commands
------------------------------------------------------
dotnet-outdated-tool      4.6.4        dotnet-outdated
You must install .NET to run this application.

App: /root/.dotnet/tools/dotnet-outdated
Architecture: x64
App host version: 8.0.8
.NET location: Not found

Learn more:
https://aka.ms/dotnet/app-launch-failed

Download the .NET runtime:
https://aka.ms/dotnet-core-applaunch?missing_runtime=true&arch=x64&rid=linux-x64&os=rocky.9&apphost_version=8.0.8```

### Expected behavior

sdk is functional after install

### Actual behavior

"You must install .NET to run this application"

### Regression?

_No response_

### Known Workarounds

_No response_

### Configuration

_No response_

### Other information

_No response_
am11 commented 2 days ago

This belongs to dotnet/sdk repo. Not sure why --allow-roll-forward is not helping global tools either (which is new in .NET 9 https://github.com/dotnet/sdk/pull/37231). Maybe it requires https://github.com/dotnet/sdk/pull/38210?

Workaround is to install it locally with the manifest option:

# install it for this project once
$ dotnet tool install --local --create-manifest-if-needed dotnet-outdated-tool

# use it with `dotnet` executable
$ dotnet dotnet-outdated