Visual Studio Code - Not able to upload nuget packge that is created locally on my computer - visual-studio

So I have written two programs(Main program and Calculatorlib) on Visual Studio Code where I have created package locally for one of the programs(Caluclatorlib)by using the command dotnet pack.
The package Calculatorlib_package.3.0.0.nupkg is created locally.
However I want to upload this package on visual studio code from my local computer so that I can give Package Reference to Main program.
I don't see any options to upload this on visual studio code.
But in Visual studio I see there is an option called "Manage Nuget packages" where we can go and upload locally created packages.
Can someone guide me how to do this?

Try adding your local package location as a Nuget package source. You should be able to add a Nuget package source using the package configuration , and add the location of the directory when you have the Nuget package locally.

Related

If I release an update to my nuget package but I don't change the version number, how does Visual Studio handle that?

Let's say I have a nuget package in my Nexus repository called MyPackage.1.0.0. I also have a solution in Visual Studio that has MyPackage.1.0.0 installed. If I make a change to my nuget package in Nexus but I don't change the version number, what happens in Visual Studio? Will Visual Studio know that the installed package is outdated? Will it automatically download the new version next time the solution is built?
No, Visual Studio will not detect this and will not use the updated package. Also, if you are using package reference nuget package management format, the package once installed gets extracted to the global packages folder. If you now try to install this package in a completely different project, nuget first looks in this global packages folder and if it finds it which it will, it will use it and not go to package sources to retrieve it again.
You can clear the local nuget caches by calling
nuget locals all -clear
from the command line.
After that, all packages will be downloaded again. This may be acceptable during development (i.e. if you need to tweak your package until it works), but clearly is not an option if others are using the same version already.

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.

Does the new Symbol Nuget package allow editing the Nuget locally?

I'm investigating the new .snupkg extension for Nuget packages and was wondering if it allows me to modify the Nuget code in Visual Studio on the fly or do I have to pack and push my new changed Nuget everytime I make a change I want to test?
wondering if it allows me to modify the Nuget code in Visual Studio on the fly or do I have to pack and push my new changed Nuget everytime I make a change I want to test?
I am afraid we could not modify the Nuget code in Visual Studio with the new .snupkg extension and still have to pack and push my new changed Nuget every time.
That because the new .snupkg extension is used to improve NuGet package debugging and symbols experience instead of automatically synchronizing code for nuget.
There are several issues with the NuGet package debugging and symbols experience before, the new .snupkg extension creates a streamlined package debugging experience for the entire NuGet ecosystem.
So, the new .snupkg extension is used to optimize debugging of nuget, we could not modify the Nuget code in Visual Studio directly and if we have any change in the nuget package, we still have to pack and push it.
You can check following document for some more details info.
NuGet Package Debugging & Symbols Improvements
Hope this helps.

Visual Studio can't find Nuget packages from private Nuget Server

I am running NuGet.Server v2.8.60717.93, hosted on Azure. The server is running correctly, and I am able to see all the packages if I go to the following url:
https://***.azurewebsites.net/nuget/Packages
I am also able to publish new packages to the server using Nuget Package Explorer.
I added https://***.azurewebsites.net/nuget as a Package Source in Visual Studio. However it can't find any packages, it just says No items found.
To my understanding, Nuget will set /Packages as default package folder unless otherwise is specified. I even tried to set packagesPath to ~/Packages, still no luck.
What am I missing?
Also have this problem the RSS feed of package is showing in the browser if I navigate to https://***.azurewebsites.net/nuget/Packages but no items found in visual studio.

Using Nuget Package Manager Dialog in Visual Studio 2013

I have set up a new package source in the Nuget Package Manager in Visual Studio 2013. The package source is our Teamcity Nuget Server. When I try to retrieve our Nuget packages from Teamcity from the Package Manager Dialog nothing is retrieved, but when I use the Package Manager Console all our packages is listed. When I use the Console I can see in Fiddler that the package source url is called, but when I use the Package Manager Dialog the package source url is not called.
I have tried to uninstall and install the Nuget package Manager extension, but that didn't work.
We use the Teamcity Nuget Server public feed url for retrieveing package information.
I'm running VS 2013 as Administrator.
Have any of you experienced the same and found a solution?
The problemm solved itself by restarting Teamcity!

Resources