Difference between NuGet packages and extensions - visual-studio

In Visual Studio under Tools menu, what is the difference between "NuGet Package Manager" -> "Manage NuGet Packages for Solution..." and "Extensions and Updates..." ?

Nuget packages are project-specific and travel through source control to your colleagues. An installed extension works in all your own solutions/projects and doesn't get shared.

Extension Manager installs extension which extends the Visual Studio meanwhile NuGet NuGet package manager helps developer to add, update and delete the external library (Packages) and their dependency in your application. Also you can create package from GuNet and share to the world.

Related

Installed nuget packages in Visual Studio 2019 project checkbox unchecked

I am trying to create a packages file for the project & noticed that installed nuget packages in Visual Studio 2019 have got the project box unchecked.
I am positive that I am using these packages in the project.
For instance I am using the Entity Framework for the data access & update. I have ensured that all the packages are still being used in the project & the packages.config file has got all the packages listed in it.
Visual Studio ScreenShot
Installed nuget packages in Visual Studio 2019 project checkbox
unchecked
The window which you provided actually does not actually work as you described. And it is just designed by that.
What you need to note is that the projects that can be displayed on this window, such as 2020Portal.Data, 2020Portal.Mailbox, etc., have already installed the nuget package Entity Framework. Only projects that already have the nuget package installed can be displayed in this window. That's why they show up there.
And the checkbox functionality is only intended to enable the selected items to perform uninstall or update the nuget Entity Framework. It's just for the convenience of choosing certain operations to perform.
Hope it could help you.

Global package installation using NuGet

Does NuGet support global package installation like NPM and Composer? If so, how do I do that? Also, how do I reference globally installed packages in my Visual Studio projects?
So learning from #Lance's tips, I went ahead and checked %userprofile%\.nuget\packages folder, and indeed it contains all the packages that I have downloaded in the past. Unfortunately though, Visual Studio (I'm using Community 2019) does not allow you to install any of these packages into a new project. The Browse page in NuGet Package Manager UI displays online results only from nuget.org.
But then I found another clue. In Visual Studio Tools > Options > NuGet Package Manager > Package Sources, you can add custom sources. So I went ahead and added my cache folder as an alternate source.
Note that there is a separate "Machine-wide package sources" entry too that cannot be modified. I checked that folder and it contains mostly Microsoft's own packages (one exception that I found there was NewtonSoft.json). I have no idea how this folder is different from the nuget cache folder and how I can download a package to this folder.
So far so good. The Package Manager now shows all previously downloaded packages from cache when I select this source from the drop down (sources dropdown is in top-right corner). I can then select a package and install it from local source instead of downloading it from the Internet.
Hope this helps someone down the line.

Even with Nuget.exe 4.1.0 - Serilog already has a dependency defined for 'Microsoft.CSharp'

I know there's an answer for this question from 2016 but it's not working today. I have VS2013 with the latest CU installed.
My Nuget package source settings:
I want to install the nu-get package "Serilog.Sinks.MSSqlServer". First, I ensure nuget is up to date by navigating to the ".nuget" folder of the solution's folder and running "nuget update -self":
Unfortunately, I still get the error when trying to add the package:
If I try to update nuget from the "Extensions and Updates" page of VS then I get a 403 error as shown below:
The 403 does suggest a proxy issue but other packages can be installed to the same dev box ok. I just installed "Apache log4net" from the Manage NuGet Packages window - no problem
Any ideas of a work-around for this please?
This might be related to the fact that you now (with the new NuGet CLI tool version) need to use the new NuGet API.
from nuget.org
NuGet feed v3 (VS 2015 and later / NuGet v3.x and above): https://api.nuget.org/v3/index.json
NuGet feed v2 (VS 2013 and earlier / NuGet 2.x): https://www.nuget.org/api/v2
You can check (and edit) your NuGet Package Sources under Tools, Options, NuGet Package Manager, Package Sources.
#Rob Bowman, in response to your comment and looking at the screenshot of your Available package sources, try edit your default nuget.org to https://api.nuget.org/v3/index.json or add a new source and make sure they're both enabled. Maybe that'll do the trick.
Update: maybe manually updating the NuGet Package Manager (since updating it through Extensions and Updates is not working) solves the problem. NuGet Package Manager for Visual Studio 2013.
Going to Visual Studio menu Help, About should display the currently installed version of this extension (and others).
To fix this I had to:
logon to a PC not connected to the corporate proxy
download the latest version of the nuget package manager (VSIX) for VS2013 from https://marketplace.visualstudio.com/items?itemName=NuGetTeam.NuGetPackageManagerforVisualStudio2013
copy the VSIX to my corporate dev VM and install

Nuget Cannot find most packages

I've installed Nuget Package Manager for Visual Studio 2015, yet when i try to install most packages I am met with the following error. Any ideas what this issue is would be greatly appreciated...
Your package source, in the drop down at the top left of the Package Manager Console, is currently set to Microsoft and .NET. If you change it to be nuget.org then it should work.
The Microsoft and .NET package source contains the NuGet packages that Microsoft supports which is subset of the packages available from nuget.org.
In Visual Studio go to the Tools -> Options menu, expand NuGet Package Manager, and then click on Package Sources. Ensure "Microsoft and .NET" is checked in the Machine-wide Package list.
When you next start the Package Manager make sure the Package Source dropdown at the top-right has a value selected.

Nuget - Don't see allow nuget to download missing packages during build

I get a message saying the following:
Error 1 Package restore is disabled by default. To give consent, open
the Visual Studio Options dialog, click on Package Manager node and
check 'Allow NuGet to download missing packages during build.' You can
also give consent by setting the environment variable
'EnableNuGetPackageRestore' to 'true'.
When I go to Tools -> Options, I do not see Package Manager and underneath I see Package Sources and Recent Packages. I do not see anywhere where I can set Allow Nuget to download missing packages during build though.
The option to give consent in the UI has been added with NuGet Package Manager 1.8. It's the 3rd item under Tools-> Options-> Package Manager-> General : "Package Restore : Allow NuGet to download missing packages during build".
Please make sure NuGet is up-to-date in Tools->Extension Manager.
Alternatively you can give consent by setting the EnableNuGetPackageRestore Environment variable to true.
I found I needed an extra couple of steps to get it to download the packages
Check Allow NuGet to download missing packages during build
Check Always show solution in Projects and Solutions
Right click on solution and Enable NuGet Package Restore
Open Manage NuGet Packages and click Restore
I did not seem to have the "Package Manager" node under Tools->Options [this was in Visual Studio 2013 :-)]. To get that node in there, I browsed to Tools -> Extensions and Updates and searched for nuget. Installing "NuGet for Visual Studio 2013" got me the node and the option to allow package restore!
I am using Visual Studio 2010 and NuGet 2.0.
Someone had checked in a solution that used NuGet for various packages. When I checked out the solution and built it, I got the same errors. What's more, when I viewed the NuGet Package Manager from the Tools -> Options window, the Package Restore already had the appropriate check boxes checked.
I tried clicking the Clear Package Cache button. After doing that, everything built correctly.

Resources