Does dotnet core have a command line package installer - nuget

It doesn't appear that the current dotnet CLI tools (1.0.1) support installing nugget packages from the command line (unless I'm missing something). Is there another way to install packages into a .Net Core 1.1 project other than by manually editing the .proj file?

dotnet add package adds a package reference to a project.
Find more information via dotnet add --help or dotnet add package --help.
If you lack that command, you might not be using the right version of the CLI.
> dotnet --version
1.0.1

Related

Is there a NuGet command to update package.config versions?

Is there a way to get NuGet to update versions in package.config to the latest available?
i.e. is there an equivalent command in NuGet for npm's npm update --save/--save-dev?
Is there a NuGet command to update package.config versions?
You can use Update-Package on Package Manager Console window to update all packages to the latest version.
Alternatively, you can also use command with nuget.exe cli:
nuget update <configPath> [options]
where identifies either a packages.config or solution file that lists the project's dependencies.

.net core installation and nuget

If I install .net core sdk does this also install nuget?
Cant seem to find anywhere that says yes. Looking to know as I am looking to do this on our build server
Looking at cli there is dotnet restore, dotnet nuget delete etc, so I am presuming yes.
If yes can I configure nuget in the same way as it is when I install nuget i.e. through this file location on windows:$env:APPDATA/nuget/NuGet.Config
Yes, the .NET Core Sdk ("CLI") contains a distribution of NuGet.
This integrated distribution is similar to the NuGet integration of VS 2017.
As you already inferred, it powers dotnet restore and the implicit restore performed during builds. There are also additional NuGet commands available via the dotnet nuget verb.
However, this is not a version of nuget.exe and most prominently does not support restoring packages.config based projects and dotnet nuget only supports a subset of features that nuget.exe offers.
Also, it uses the user-wide NuGet.Config from %APPDATA%\NuGet\NuGet.Config directory on windows and ~/.nuget/NuGet.Config on non-windows systems.

dotnetcore Nuget enable Pre-Release

I've started using dotnetcore for a hobby project.
I'm having an issue trying to install NLog. The Visual Studio Code editor seems to recognise the beta version as the intelisense suggests it inside the project.json file. However nuget doesn't seem to restore it.
Is there a way to enable pre-release on Nuget packages in the new dotnet core platform?
Is the package on the Nuget repo? Check this link to see if its listed:
https://www.nuget.org/packages/NLog
If it's on there you can just add it to your project.json and then run a dotnet restore to install the nuget, no intellisense required.
I came across the answer to my question whilst watching a PluralSight video on Entity Framework Core By Dr Scott Allen.
One option is to use the visual studio package manager console and use the -pre flag. e.g:
install-package Microsoft.EntityFrameworkCore.tools -pre

Package manager console Add-Migration command not working

First of all, all other questions here with this problem are for ASP.NET Core projects, and the solution is to add the Microsoft.EntityFrameworkCore.Design to the tools section on project.json, but... I'm not using ASP.NET Core, so I don't have project.json in my project. So please keep it in mind before marking it as duplicate since I saw that's a fairly common question...
When I type add-migration InitialMigration on Package Manager Console I get the following error:
Cannot execute this command because Microsoft.EntityFrameworkCore.Design is not installed. Install the version of that package that matches the installed version of Microsoft.EntityFrameworkCore and try again.
But as you can see on the image bellow, it is installed on this project:
My database layer is in a separated project, which is Full Framework ClassLibrary, and because of this I don't have a projec.json file.
Does anyone tried to use migrations on class libraries projects?
In dotnet core this is typically due to the fact that you're missing a package. Go into the NuGet Package Manager on the solution level and install Microsoft.EntityFrameworkCore.Tools for your project.

Nuget upgrade issues

I recently installed Visual Studio on a new computer and as a result I now have Nuget 1.5.2. This version doesn't seem to work with my old solution. When I add a new project and try adding references via Nuget, it says they are already installed and does nothing, even though that reference doesn't exist in the new project.
Does anyone know why this might be happening or alternatively where I can download the old Nuget (1.4.2)?
Thanks!
The NuGet Command Line is available as a NuGet package.
Just like with any other NuGet package, you can get a specific version by using the -Version switch in the Package Manager Console.
To get v1.4.2 of the NuGet command line tool, you should execute the following PowerShell script from the Package Manager Console:
Install-Package Nuget.CommandLine -Version 1.4.20615.182