繁体   English   中英

通过 Arch 上的 do.net-install 脚本安装 .NET SDK Linux

[英]Installing .NET SDK via the dotnet-install script on Arch Linux

我正在运行 Arch Linux,我希望通过do.net-install 脚本安装 .NET 6.0 SDK。

我已经更改了脚本的权限,使其成为可执行文件,然后运行:

./dotnet-install.sh --channel LTS

这是 output:

dotnet-install: Note that the intended use of this script is for Continuous Integration (CI) scenarios, where:
dotnet-install: - The SDK needs to be installed without user interaction and without admin rights.
dotnet-install: - The SDK installation doesn't need to persist across multiple CI runs.
dotnet-install: To set up a development environment or to run apps, use installers rather than this script. Visit https://dotnet.microsoft.com/download to get the installer.

dotnet-install: .NET Core SDK version 6.0.102 is already installed.
dotnet-install: Adding to current process PATH: `/home/j/.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.

请注意它是如何显示SDK version 6.0.102已安装的。

但是,当我运行时:

~/programs ❯ dotnet --list-sdks    
~/programs ❯ 

如您所见,我没有得到 output,但是在运行时:

~/programs ❯ dotnet --list-runtimes
Microsoft.AspNetCore.App 6.0.2 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.2 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
~/programs ❯ 

我列出了运行时。

这里发生了什么? 当我尝试构建代码时,我得到:

~/code/mechanic360.api main ❯ dotnet build .        
Could not execute because the application was not found or a compatible .NET SDK is not installed.
Possible reasons for this include:
  * You intended to execute a .NET program:
      The application 'build' does not exist.
  * You intended to execute a .NET SDK command:
      It was not possible to find any installed .NET SDKs.
      Install a .NET SDK from:
        https://aka.ms/dotnet-download
~/code/mechanic360.api main ❯    

如您所见,它找不到 SDK。我错过了什么?

您可以使用--runtime/-r标志来做到这一点。

样张

拱的例子:

dotnet build -r linux-x64
dotnet run -r linux-x64
dotnet publish -r linux-x64

解释链接

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM