aspnet / LibraryManager

Other
446 stars 78 forks source link

version 2.1.175 doesn't support .Net 7.0.11 #718

Closed CyberGuerro closed 9 months ago

CyberGuerro commented 9 months ago

Describe the bug

I'm on Linux and I installed .Net-SDK 7.0.401 (last stable version) Installed tool with dotnet tool install -g Microsoft.Web.LibraryManager.Cli when I run libman command I get this message: `You must install .NET to run this application.

App: /home/claudio/.dotnet/tools/libman Architecture: x64 App host version: 7.0.11 .NET location: Not found

Learn about runtime installation: https://aka.ms/dotnet/app-launch-failed

Download the .NET runtime: https://aka.ms/dotnet-core-applaunch?missing_runtime=true&arch=x64&rid=gentoo.2.14-x64&apphost_version=7.0.11`

To Reproduce

Steps to reproduce the behavior:

  1. Using this version of Visual Studio Code '1.82.2'
  2. run libman command in termina window
  3. See error reported above

Expected behavior

Command runs correctly

Additional context

Installing tool throw Nuget package Nuget advise me that package is not compatible with .Net installed versione (7.0.11)

jmoralesv commented 9 months ago

I found the reason, it's because the Microsoft.Web.LibraryManager.Cli global tool is compiled against .NET Core 2.1, according to the frameworks tab in the page in NuGet https://www.nuget.org/packages/Microsoft.Web.LibraryManager.Cli/#supportedframeworks-body-tab

And this is confirmed when looking at the csproj: https://github.com/aspnet/LibraryManager/blob/main/src/libman/libman.csproj#L5

.NET tools (global or local) must have the .NET SDK they were built on installed on the target machine: https://learn.microsoft.com/en-us/dotnet/core/tools/global-tools

A "workaround" would be to install the .NET Core 2.1 SDK on the target machine, however that's not a solution. The real solution would be that the LibMan.Cli tool gets upgraded to .NET 7, so it can be installed and used in modern projects.

CyberGuerro commented 9 months ago

Ok, do you think to deploy new version for .Net 7 soon?

jmoralesv commented 9 months ago

@CyberGuerro I don't see too much activity in this repo, so I don't think it will be anytime soon. We just have to wait and see. If I had some time, I would make a fork and send a pull-request.

jimmylewis commented 9 months ago

The runtimeconfig.template.json file does specify rollForwardOnNoCandidateFx, so theoretically it should run on any newer version of .NET when the 2.1 runtime is not installed (that's the reasoning why it hasn't been bumped). I haven't had a chance yet to reproduce and debug why that's not holding true in this case ("it works on my machine" with 6.0+ installed, but that's not helpful... I need to set up a Linux VM and try it there).

jimmylewis commented 9 months ago

This evening I set up a fresh Ubuntu VM, installed the dotnet 7 SDK, ran dotnet tool install -g Microsoft.Web.LibraryManager.Cli, refreshed my user profile, and then running libman works as expected.

I noticed a few differences between what I did and what you describe:

Can you verify if running outside of VS Code in a normal shell works? Also, can you describe more how you installed dotnet itself? (The libman command obviously is executing something, but it seems to be unable to locate the runtime.) Lastly, can you share an example of another tool that is working fine for you when installed the same way (dotnet tool install -g ...)?

CyberGuerro commented 9 months ago

I tried run libman command outside VSCode and I had the same result (tried to reinstall, but nothing changes)

I installed dotnet SDK bin using my distribution package installer manager (gentoo uses "emerge package_name" command) and all files installed by "emerge" are under.

/opt/dotnet-sdk-bin-7.0

and executable is /usr/bin/dotnet which symlink executable in above folder

Finally, for the your last request can you suggest me another package to install using dotnet command?

jimmylewis commented 9 months ago

You could try installing dotnet-dump, and then invoke it with dotnet-dump --help. As long as that executes, then it's able to find the runtime and the issue may be with the libman tool; if dotnet-dump also doesn't work, then it's most likely an environment issue (i.e. not an issue with a specific package).

CyberGuerro commented 9 months ago

dotnet-dump like libman doesen't work and return this error: You must install .NET to run this application.

App: /home/claudio/.dotnet/tools/dotnet-dump
Architecture: x64
App host version: 7.0.11
.NET location: Not found

Learn about runtime installation:
https://aka.ms/dotnet/app-launch-failed

Download the .NET runtime:
https://aka.ms/dotnet-core-applaunch?missing_runtime=true&arch=x64&rid=gentoo.2.14-x64&apphost_version=7.0.11
jimmylewis commented 9 months ago

In that case, it seems to be an issue with your environment. I'd recommend asking for assistance with the maintainers of the dotnet package in Portage (maybe using the contact info from https://wiki.gentoo.org/wiki/Project:Dotnet). You could possibly also try asking for help from the dotnet sdk team, but since Gentoo isn't an officially supported platform, I'm not sure if they'll have much info to assist.

Closing the issue here, since it's not specific to libman, and there isn't anything we can do to address it.