如何在linux上从命令行安装NuGet

时间:2023-01-24 13:15:15

I need to install NuGet on Linux based machine.When am using the following command in Windows machine it works fine.

我需要在基于Linux的机器上安装NuGet。当我在Windows机器上使用以下命令时,它可以正常工作。

nuget install packages.config

nuget安装packages.config

But I am unable to do this with linux machine, how to achieve this?

但我无法用linux机器做到这一点,如何实现呢?

3 个解决方案

#1


32  

Once you've followed the (somewhat annoying) install steps to get .Net core installed and the apt repo setup from https://www.microsoft.com/net/core, you can just do this:

一旦你按照(有点烦人的)安装步骤来安装.Net core并从https://www.microsoft.com/net/core安装apt repo,你就可以这样做:

sudo apt install nuget

and you'll have a working nuget on your local machine:

你将在你的本地机器上有一个工作的nuget:

$ cat /etc/issue
Ubuntu 16.04.1 LTS \n \l

$ nuget
NuGet Version: 2.8.7.0
usage: NuGet <command> [args] [options] 
Type 'NuGet help <command>' for help on a specific command.

Notice that as of the time of writing do not run nuget update -self, as although it will successfully install a more recent version of nuget, that version won't actually run.

请注意,截至编写本文时,不要运行nuget update -self,因为尽管它将成功安装更新版本的nuget,但该版本实际上并不会运行。

If you do break it though, you can always just blow it away and reinstall:

如果你确实打破它,你可以随时把它吹走并重新安装:

sudo apt remove nuget
sudo apt install nuget

#2


12  

nuget apt package doesn't really work on linux, and exe's are for windows. If you want to run nuget the easiest thing is to use mono wrapper.

nuget apt包在linux上不起作用,而exe用于windows。如果你想运行nuget,最简单的方法就是使用单声道包装器。

sudo apt-get install mono-complete
//download nuget.exe
mono nuget.exe install

#3


11  

Install mono, download nuget: sudo apt-get install mono-complete wget https://dist.nuget.org/win-x86-commandline/latest/nuget.exe

安装mono,下载nuget:sudo apt-get install mono-complete wget https://dist.nuget.org/win-x86-commandline/latest/nuget.exe

After then run it using mono nuget.exe.

然后使用mono nuget.exe运行它。

#1


32  

Once you've followed the (somewhat annoying) install steps to get .Net core installed and the apt repo setup from https://www.microsoft.com/net/core, you can just do this:

一旦你按照(有点烦人的)安装步骤来安装.Net core并从https://www.microsoft.com/net/core安装apt repo,你就可以这样做:

sudo apt install nuget

and you'll have a working nuget on your local machine:

你将在你的本地机器上有一个工作的nuget:

$ cat /etc/issue
Ubuntu 16.04.1 LTS \n \l

$ nuget
NuGet Version: 2.8.7.0
usage: NuGet <command> [args] [options] 
Type 'NuGet help <command>' for help on a specific command.

Notice that as of the time of writing do not run nuget update -self, as although it will successfully install a more recent version of nuget, that version won't actually run.

请注意,截至编写本文时,不要运行nuget update -self,因为尽管它将成功安装更新版本的nuget,但该版本实际上并不会运行。

If you do break it though, you can always just blow it away and reinstall:

如果你确实打破它,你可以随时把它吹走并重新安装:

sudo apt remove nuget
sudo apt install nuget

#2


12  

nuget apt package doesn't really work on linux, and exe's are for windows. If you want to run nuget the easiest thing is to use mono wrapper.

nuget apt包在linux上不起作用,而exe用于windows。如果你想运行nuget,最简单的方法就是使用单声道包装器。

sudo apt-get install mono-complete
//download nuget.exe
mono nuget.exe install

#3


11  

Install mono, download nuget: sudo apt-get install mono-complete wget https://dist.nuget.org/win-x86-commandline/latest/nuget.exe

安装mono,下载nuget:sudo apt-get install mono-complete wget https://dist.nuget.org/win-x86-commandline/latest/nuget.exe

After then run it using mono nuget.exe.

然后使用mono nuget.exe运行它。