Add Nuget reference to VS project package from command line

前端 未结 2 1833
悲哀的现实
悲哀的现实 2021-01-25 01:50

Is it possible to add a NuGet reference to an existing VS project (csproj or jsprox) using some command line tool?

I would need a functionality like package manager cons

相关标签:
2条回答
  • 2021-01-25 02:24

    If you are using .NET Core there is now a way to achieve this using the dotnet CLI.

    dotnet add package EntityFramework
    

    See Steve Smith's blog post for more information.

    0 讨论(0)
  • 2021-01-25 02:47

    This is not supported with NuGet.exe. With NuGet.exe you can download the NuGet packages based on what is in the packages.config file. You can also update NuGet packages and have their references updated in the project file by using NuGet.exe update. However you cannot use NuGet.exe to install the NuGet package so it adds the required references to the project file.

    It is supported with Paket however if you use Paket then you would need to switch to using Paket for all NuGet packages since it has its own way of referencing the NuGet packages which does not include using the packages.config file. It also does not support PowerShell scripts.

    I looked at installing NuGet Packages from the command line outside of Visual Studio using SharpDevelop and a set of PowerShell commands. This was a proof of concept but is not supported and requires most of SharpDevelop to be available.

    0 讨论(0)
提交回复
热议问题