0

I have created a nuget package and I want to share it with my team using Nuget Gallery.

I need to publish the nuget package privately. So I have managed to build the Nuget Gallery from Nuget Gallery build steps When I run the build, Google Chrome shows up with "localhost" website address showing Nuget Gallery.

1) How do I add the nuget package that I have created recently to the local Nuget Gallery? 2) How do I publish the Nuget Gallery and share with my team after I have managed to add nuget package in that gallery?

Thanks

hunterex
  • 565
  • 11
  • 27

2 Answers2

1

You can also create your own Nuget server running in your local network by using the Microsoft NuGet.Server available in nuget.org ;-)

Florian SANTI
  • 531
  • 1
  • 5
  • 13
0

If you haven't seen it already, have a look at the docs on hosting a private nuget feed. TeamCity has a NuGet feed built-in, so you may not need to host a NuGetGallery yourself.

Depending on where/how you host your private feed, it might have a UI that you can use to upload packages (such as the NuGet Gallery). But if you're creating packages as part of a CI pipeline, it's probably easier to just use nuget push and use the -Source parameter to specify which source you want to push to, assuming your nuget.config has more than once source defined.

zivkan
  • 12,793
  • 2
  • 34
  • 51
  • ok I managed to publish my private Nuget Gallery at my own website link called: http://DevComp/nugetgallery. How do I connect that private Nuget Gallery to my Visual Studio NuGet-Solution to download the Nuget package? I have tried the steps in https://stackoverflow.com/a/52585632/4177530 but I got error message saying: [local] The V2 feed at 'http://DevComp/nugetgallery/Search()?$filter=IsLatestVersion&searchTerm=''&targetFramework='net461'&includePrerelease=false&$skip=0&$top=26&semVerLevel=2.0.0' returned an unexpected status code '403 Forbidden'. Thanks. – hunterex Nov 12 '18 at 16:25
  • I don't recommend setting the source in the Visual Studio UI because it modifies your user profile nuget.config, meaning your teammates and the CI agent (TeamCity in your case) won't be able to restore your private packages unless they do the same. Instead, create a nuget.config file in your repo root, or next to your .sln, and use [``](https://learn.microsoft.com/en-us/nuget/reference/nuget-config-file#package-source-sections). This way there's zero additional configuration per person/machine – zivkan Nov 13 '18 at 12:56
  • 1
    about the forbidden message, it's because gallery doesn't have a controller that handles that url, so IIS is trying to search for a file with that name, but IIS is configured not to allow serving files from that folder, hence forbidden. Anyway, you need to configure nuget to use the [API URL](https://github.com/NuGet/NuGetGallery/blob/bf7e98f696e346b55cb1eba38866682ae936160f/src/NuGetGallery/Controllers/ODataV2FeedController.cs#L322), not the website URL. – zivkan Nov 13 '18 at 13:01