You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Ubuntu 18.04 WSL中安装最新版本NuGet.exe CLI?

Yes, you can install NuGet 5.x.x on WSL Ubuntu 18.04!

The default apt repository for Ubuntu 18.04 only ships with the outdated NuGet 2.8.x, but there are two straightforward ways to get the latest 5.x.x version:

NuGet 5.x+ is tightly integrated with the .NET SDK, so installing the SDK gives you access to the latest NuGet tooling along with other .NET utilities. Here's how:

  1. Add Microsoft's software repository to your system:

    wget https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
    sudo dpkg -i packages-microsoft-prod.deb
    rm packages-microsoft-prod.deb
    
  2. Install the .NET SDK 5.0 (or a newer version like 6.0 if preferred):

    sudo apt-get update
    sudo apt-get install -y apt-transport-https
    sudo apt-get update
    sudo apt-get install -y dotnet-sdk-5.0
    
  3. Verify the installation:
    Run dotnet nuget --version — you should see a 5.x.x version number pop up if everything worked.

  4. Run your package install command:
    Use dotnet nuget install Test.Nuget.Version -OutputDirectory packages instead of the standalone nuget command. It works exactly the same way for your use case.

Method 2: Install the standalone NuGet CLI

If you only need the NuGet tool and don't want the full .NET SDK, you can download the official NuGet CLI binary directly:

  1. Grab the latest NuGet CLI executable:

    wget https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
    
  2. Run it using Mono (since it's a Windows executable):
    First install Mono if you don't have it:

    sudo apt install mono-complete
    

    Then execute your command with:

    mono nuget.exe install Test.Nuget.Version -OutputDirectory packages
    
  3. (Optional) Make it easier to use:
    Move the executable to your system path so you can run it without typing mono every time:

    sudo mv nuget.exe /usr/local/bin/nuget
    

    Now you can just run nuget install Test.Nuget.Version -OutputDirectory packages directly.

Method 1 is the more stable and maintainable option, as it keeps your NuGet tooling in sync with the official .NET ecosystem.

内容的提问来源于stack exchange,提问作者Unknown

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.14 07:27:22