Published NuGet packages not showing in remote NuGet Feed? - visual-studio-2013

I am setting up a NuGet server to host our packages internally. I followed the steps listed below:
https://docs.nuget.org/create/hosting-your-own-nuget-feeds
but having issues.
I have a site setup in IIS on the TFS server and can navigate to the URL successfully. I see the "You are running NuGet Server 2.8.5 but the link to view your packages doesn't show any packages. However, I can publish packages successfully from the visual studio project to the remote package path which is the normal inetpub\wwwroot etc. The packages show up in the path correctly and also show up in visual studio in manage packages menu. Anyone have an idea why they aren't showing up in the package feed URL?
I would greatly appreciate any help I could get.
Thanks,

I was having similar issues. I was able to get it working by using the full file path in packagesPath key of the web.config. I could not use a relative path.

Related

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.

Nuget package install error -- Invalid URI: The Authority/Host could not be parsed

I'm using NuGet within Visual Studio 2017 to try to install a package on an older Web Forms project, and it is failing with the following error:
Invalid URI: The Authority/Host could not be parsed
This only happens when trying to install the package on a website that is mapped in IIS (other types of projects work fine), so the project name is http://localhost..., etc., which is what I think it's having trouble parsing. It worked fine until just a few days ago and I'm not sure what caused it to change. Here is the full message I am receiving:
Resolved actions to install package 'Newtonsoft.Json.10.0.3'
Found package 'Newtonsoft.Json 10.0.3' in 'd:\packages'.
Package 'Newtonsoft.Json.10.0.3' already exists in folder 'd:\packages'
Install failed. Rolling back...
Package 'Newtonsoft.Json.10.0.3' does not exist in project 'http://localhost:89/'
Executing nuget actions took 71.95 ms
Failed to add reference to 'Newtonsoft.Json'.
Invalid URI: The Authority/Host could not be parsed.
Another related clue is that when I open "Manage NuGet Pacakges..." on the website project, it is not showing anything as being installed, even though the packages.config file clearly exists in this project with several references defined.
My environment is as follows:
Visual Studio Professional 2107 Version 15.5.2,
Microsoft.NET Framework Version 4.7.02556,
NuGet Package Manager Version 4.5.0, and my NuGet repository is set to install in D:\packages
Does anyone have any advice on what setting I might be able to change to get this working again?
NuGet does not appear to be working for local IIS Web Site projects in VS 15.5.1 to 15.5.5 (inclusive).
The workaround is:
Close VS
(Just in case) make a backup copy of the .sln (solution file)
In a text editor open the .sln file and find the line:
Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "http://www.devsite.com", "http://www.devsite.com", "{A8837508-9BC1-482A-86EF-4B3156CAFDBE}"
Amend the second parameter and save:
Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "http://www.devsite.com", "DevWebsiteFolderName", "{A8837508-9BC1-482A-86EF-4B3156CAFDBE}"
Open your solution.
Use NuGet as you wish :-)
Optional:
Close VS
Reverse your .sln change.
Open VS
For credit and further reference:
NuGet fails for website projects hosted on local IIS
Nuget looking in wrong location for packages.config in web forms web site running on IIS
This was driving me nuts... I spent hours trying to install the Authorize.net nuget package in VS2017 and it kept throwing the same error.
I finally opened my project up in VS2015 and installed it without any issues.
Hope this helps.
Jason
Given that we haven't gotten any help from Microsoft on this, we've adopted the convention of doing something like what Barry Kaye suggested, but for the second parameter, just replacing it with a single period "."
This issue appears to be fixed in 15.6.0. Try upgrading to that version, if you can.
I encountered the same problem and I solve it this way:
Right-click on the project -> Properties -> Debug -> App URL
(The app URL was not the correct one)

Nuget Package - feed (VSTS) :Exception 'System.AggregateException' thrown when trying to add source

I have created a new feed with in Package Release hub (VSTS), installed the credentials, then added the package source.
Now, I am using Visual Studio 2015 to install Micrososft.Aspnet.mvc to a project, however it gives the following error:
Exception 'System.AggregateException' thrown when trying to add source
'https://mysite.pkgs.visualstudio.com/DefaultCollection/_packaging/MyLogUtils/nuget/v3/index.json'.
Please verify all your online package sources are available.
I need to install NuGet packages normally, so I removed the feed from VSTS. However, the problem persists. How can this problem be resolved?
I met this issue today and fix it by following:
If you have delete the feed from VSTS, then you need to delete it from VS\Tools\Options\Nuget Package Manager\Package Sources:
If you didn't delete the feed in VSTS and want to use it, sign in with your VSTS team project account from VS upper right corner and restart VS:
This is may be an addition to the actual answer. I had to disable the check boxes as shown in below image to get the issue resolved. I think it might help to someone.
I had the same issue and I fixed issue by disabling my custom NuGet servers.
Go to Tools->Options->Nuget Package Manager and disable your custom NuGet servers
Since this is the first Page I hit with my Problem:
If you get the error for nuget.org site, increase Version number:
https://api.nuget.org/v3/index.json -> https://api.nuget.org/v4/index.json
under Tools->Options->Nuget Package Manager (see Image from #Eddie-MSFT)
V3 doesn't seem to work since today.
I also encountered that issue. I solved it by manually saving the index.json file and adding a local packaged source.
I had same issue, I resolved it by disabling its custom nuget server.
This exception might get when NuGet.Config file is readonly, for me unchecking the reaonly property of that file worked, generally, Nuget.config file exists in your project under .nuget folder.
File path project dir/.nuget/NuGet.Config
You have to ensure all your configured package source servers are available. Otherwise simply Go to Tools->Options->Nuget Package Manager and disable your custom NuGet servers.
One of the following might solve your problem.
Check and uncheck the package sources and click on update button, restart visual studio.
Uncheck all the other package source and only keep the one from nuget.org and click on update button, restart visual studio.
Once your package is install redo the changes as before.
'System.AggregateException' thrown when trying to add source 'https://devops.MyCompany.com/MC/_packaging/SharedFunctionalist/nuget/v3/index.json'. Please verify all your online package sources are available. One or more errors occurred.
Unable to load the service index for source https://devops.MyCompany.com/MC/_packaging/SharedFunctionalist/nuget/v3/index.json. Response status code does not indicate success: 401 (Unauthorized).
I got the same issue today.If you have noticed that It may asked you to enter DevOps credentials.That means it's request you to login your DevOps account.
There are two options for this type issue
1.Login with DevOps account(your Team Account) with your credentials.Then you can Install Nuget packages as usual.
2.Otherwise you have to delete existing package package source(which one is shared with team)by following below steps.
`Open Visual Studio ->Tools->Options->Nuget Package Manager-> Package Sources ->select that shared package Source and Delete it
Go to Tools->Options->Nuget Package Manager->Package Sources and uncheck the online NuGet Source named nuget.org https://api.nuget.org/v3/index.json. Also make sure your offline source is checked
I had the same problem. I resolved it by removing the checkmark from Tools/Options/Nuget Package Manager/Package Sources.
For me the package provoking the error was not showing up in the list of NuGet Sources (is it a bug?).
I had to go through the CLI (terminal) and enter
nuget sources
to get the list of Nuget sources.
Once the source causing the issue was listed I could remove it (you can also disable it)
nuget sources Remove -Name "source"
Documentation here
After that, restart Visual Studio

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.

TFS 2013 Build definition giving error to access .nuget (type UnauthorizedAccessException)

I am facing an issue of permsission related to .nuget while I am using build definition of TFS 2013.
I have already applied 'Enable NuGet Package Restore' option in my Visual Studio solution.
(I am using latest version of NuGet package manager.)
I am getting an error mentioned as given screenshot.
Thanks in advance!
Your build service was set to run with LOCAL SERVICE account. Right click on C:\Builds and make sure it has full permissions on that folder. Alternatively run the build service as a domain user account (e.g. DOMAIN-NAME\tfsbuild) or NETWORK SERVICE.

Resources