1

I created my own Nuget Server following the documentation and I got it, but I cannot access the packages from Visual Studio 2019 Community Nuget Package Manager.

So, when I do it through a browser I get this, which seems fine: enter image description here

When I click on "here" to view the packages I see the test one I added, and if I click it I can even download it:

enter image description here

However, when I access by Visual Studio I get this:

enter image description here

The full error says:

[Nuget Server] The V2 feed at 'http://mywebsite.com/NugetServer/Packages/Search()?$filter=IsLatestVersion&searchTerm=''&targetFramework=''&includePrerelease=false&$skip=0&$top=26&semVerLevel=2.0.0' returned an unexpected status code '404 Not Found'. But I can't figure out why.

This is how I added it to the Nuget Manager:

enter image description here

This is the folder structure of the site: enter image description here enter image description here

As you can see the package test.1.0.0.nupkg is where the NugetServer project told me to put it.

I tried several things:

  • Giving Everyone FullControl of the folder (because at the beginning I got 403 Forbiden instead of 404)

  • Changing the folder structure, puting the nupkg package inside a folder named nuget, put the whole Packages folder inside the nuget folder and other things I saw as solutions in other Stackoverflow threads.

  • Transforming everything to VB as this Stackoverflow thread suggested.

  • Changing IIS parameters

Nothing worked for me, so I need a bit of help to find the way.

Maybe I need something for the "Search()" to work? I'm lost.

If you need more info I can provide, just ask, please.

serfe
  • 285
  • 5
  • 13

2 Answers2

3

Please go to Tools > Nuget Package Manager > Package Sources and check the resource is https://api.nuget.org/v3/index.json as below:

enter image description here

Jeremy Caney
  • 7,102
  • 69
  • 48
  • 77
1

Nothing worked for me, so I need a bit of help to find the way.

Maybe I need something for the "Search()" to work? I'm lost.

If you need more info I can provide, just ask, please.

First, since you can get the nuget package and view the package on your local website according to this document, I'm sure you have no problem with the steps to create your own nuget server.

The main reason is that you use the wrong link such as the view package in the Package Source. Instead, you should use the Repository URLs which is specified. The error is just it cannot

Repository URLs

In the package manager settings, add the following URL to the list of Package Sources:https://xxxxxxxxx/NugetServer/nuget.

Adding packages

To add packages to the feed put package files (.nupkg files) in the folder D:\xxxxx\xxxx\NugetServer\Packages

So please refer to the related info in your PC.

Update 1

Sloution

1) put the nuget packages into your local path like D:\xxxxx\xxxx\NugetServer\Packages so that you can access the packages through your links.(do not create any other new folders and put packages into them)

2) change the package source to http://xxxxxx/NugetServer/nuget as Repository URLs in your PC saids.

Update 2

In addition, please do not forget to run the instance of the NugetServer project at the same time and when the first screenshot that you provided shows, you should follow the guidance of it.

Hope it could help you.

Mr Qian
  • 21,064
  • 1
  • 31
  • 41
  • So, I added a new folder called nuget inside the NugetServer one and put the nupkg package inside. .../NugetServer/nuget/test.1.0.0.nupkg. I went to Visual Studio and update the Package Source to have as Source: http://mywebsite.com/NugetServer/nuget/ Still got same error 404. I tried restarting VS, just it case, but nothing changed. – serfe Dec 10 '19 at 09:36
  • Sorry for not explaining clearly. You should not add a new folder called nuget and just put the nuget packages into `Packages folder` which is the default folder. The URL is just the address to get the package not a physical path – Mr Qian Dec 10 '19 at 10:51
  • According to [this document](https://learn.microsoft.com/en-us/nuget/hosting-packages/nuget-server) and from the interface after launching NugetServer project, we know that we should add the new nuget packages into the local path like `D:\xxxxx\NugetServer\Packages` and then add the link `http://mywebsite.com/NugetServer/nuget` into package source to get them. – Mr Qian Dec 13 '19 at 02:18
  • I'll check on monday and tell you. Thanks for keeping the track. – serfe Dec 13 '19 at 08:13
  • Now I kept the packages in NugetServer/Packages and the link to /nuget in Package Manager, but it still gives me 404. I tried to run the project locally and put the local path as link and it works fine, but of course this is not going to work when I set it up as a web server. – serfe Dec 16 '19 at 07:46
  • @serfe, in addition, l wonder if you followed [this Microsoft document](https://learn.microsoft.com/en-us/nuget/hosting-packages/nuget-server) to create a nuget.server. If you followed it, l think you should use the domain url as it said like `http://localhost:xxxxx/nuget`. From the picture, l found that the `Repository URLs` and the `package source URL` are not the same, l wonder why you use the different. If you follow the `Repository URLs`, l think it could work. If the document you followed is not this one, please feel free to correct me. – Mr Qian Dec 18 '19 at 02:17
  • Hi @PerryQian-MSFT, facing similar kind of issue.Version used for nuget.server is 2.14.2 as the latest version facing problem with push. Able to push the package using "http:\\localhost:6000\" url which using url "http:\\localhost:6000\api\v2\package". Configuring VS package manager with same url gave below error. [Package source] The V2 feed at 'http://localhost:6000/api/v2/package/Search()?$filter=IsLatestVersion&searchTerm='NugetPackage'&targetFramework='net46'&includePrerelease=false&$skip=0&$top=26&semVerLevel=2.0.0' returned an unexpected status code '404 Not Found'. – Aditya Pewekar May 14 '20 at 11:14