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
Related
I am facing a problem with my project.
The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?
This has happened before and I solved it by reinstalling the Nuget Package Manager using a command. Unfortunately, I am not finding that command again. I tried to find the solution online but everything I am getting is installing/reinstalling NuGet packages and not package manager.
Found this article: https://forums.asp.net/t/1776324.aspx?How+to+install+upgrade+VS+NuGet+Package+Manager+ but It's not applicable here.
NuGet Package Manager is preinstalled in VS2019 and no separate package to download and install. Also, there's not Extension Manage in VS2019 like older versions.
Please Let me know the command to reinstall NuGet Package Manager in Visual Studio 2019.
Such nuget restore issues can normally fix by deleting the obj folder where the nuget files like project.assets.json, projectname.csproj.nuget.g.targets, projectname.csproj.nuget.g.props, projectname.csproj.nuget.dgspec.json and projectnamecsproj.nuget.cache are stored.
If this still doesn't fix it, delete the hidden .vs folder inside the solution, where Visual Studio stores the user settings for the project.
We have a .net solution that contains .net standard 2.0 projects and .net framework projects.
On each build with TeamCity we have a step with NuGet Installer to restore the nuget packages for solution (nuget version 4.3.0). The step works fine, it restores the nuget packages but on Nuget Packages tab at Used Packages section we see only the nugets from .net framework projects.
Only the .net framework projects have packages.config file, the .net standard 2.0 ones doesn't have this files because nuget package manager uses PackageReference by default (as stated here https://learn.microsoft.com/en-us/nuget/consume-packages/package-references-in-project-files) so the nugets used are included in .csproj files.
What can be done in order for nuget packages for .net standard 2.0 projects show up on on Nuget Packages tab at Used Packages section ?
Thank you,
Adriana
Seems is a known issue of TeamCity, and if we need it fixed we should vote for it here: https://youtrack.jetbrains.com/issue/TW-52327
If anyone else has a workaround till is fixed please post it :)
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.
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.
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