DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Newsletter
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • How To Publish and Install DotNet SDK With NuGet

Trending

  • To Switch, or Not to Switch the AI Model
  • Chaos Engineering and Kafka In Action: Topic Level Idempotence and Retry Check
  • DZone's Article Types
  • Member Spotlight: Pavan Belagatti

Draft This article hasn't been published, so readers can't see it.

In moderation This article is waiting for review, so readers can't see it yet.

Deleted This article has been deleted, so readers can't see it.

How to Set Up a Local NuGet Gallery

By 
Michael Ceranski
·
Feb. 06, 12 · News
Post on X (opens in a new tab) Share on LinkedIn (opens in a new tab)
20.9K Views

Join the DZone community Save articles, join the discussion, and download Refcards and Trend Reports with a free account.

Join for free Already a member? Log in

First of all you may be wondering, why do I want my own local Nuget Gallery? Well, here are two reasons:

  • Having your own NuGet server is perfect for when you need share modules with other people on your team but you do not necessarily want to make them available for public consumption.
  • If you are a consultant then having your own personal NuGet Gallery may be a handy way to keep your libraries and utilities accessible to you when you are on the road. This is an great way to utilize your home broadband connection.

Last year I wrote an article about how to Build a NuGet Server with gold plating. At the time, there were two methods for hosting your own NuGet feed. The first option was to install the Orchard-based NuGet Gallery. I personally stayed away from this option because setting up an entire CMS just to host a few small NuGet packages seemed like overkill to me. The second option was to create an empty ASP.NET MVC site and install a few NuGet packages from Phil Haack that turned your empty website into a NuGet server. I call the second option the recursive NuGet server because you install NuGet packages which in turn help you to create a NuGet server. Anyway, if you compare the features of the Orchard Nuget Gallery to the recursive NuGet server, you will instantly notice that the Orchard version had a lot more functionality. Unfortunately, at the time I still could not justify setting up an entire CMS just to get a few small features.

Eventually someone on the NuGet team realized that having the gallery so tightly coupled with Orchard was probably not a good idea. So sometime late last year, the NuGet gallery was removed from Orchard which made the setup process a lot less complex. Unfortunately the documentation page for Setting Up a Local NuGet Gallery has not been updated yet and still reflects the steps for creating the Orchard-based gallery. Since I recently setup a NuGet server at the office I decided to document the new steps in order to save you some trouble.

  1. Download the latest source from GitHub. I just grabbed the zip file since I do not have a Git client on my machine.
  2. Extract the zip file and navigate to the Website subdirectory. Locate the web.config file and open it up in your favorite editor. Inside the web.config you will want to change the following options:
    1. Modify the configuration/connectionStrings/NuGetGallery key so it points to your locally hosted SQL Server.
    2. Change the appSettings/GalleryOwnerEmail to the email address of the person who is going to administer the site.
    3. Change the appSettings/Configuration:SiteRoot to reflect the domain name you are going to use for the site.
  3. Run the Build-Solution.ps1 script using Powershell in the root directory. This will compile the website and assemble the binaries.
  4. Open up your IIS Manager
    1. Create a new application pool. The pool should use the 4.0 framework and use an integrated pipeline. Please pay careful attention to the Identity of the pool because you will need to grant this account permissions to your SQL Server.
    2. Create a new website. Set the site’s physical path to point at the Website directory. Also make sure the site uses the application pool that you created in the previous step. Do not start the website yet.
  5. Open up SQL Server Management Studio
    1. Grant db_creator to the identity of the application pool you created earlier. The account needs db_creator because the first time you run the applicaton, the Entity Framework context initializer will run. If no database exists yet then it will create the database for you. After, the database is created you can trim back the permissions to db_datareader and db_datawriter. This tends to make your DBA happy.
  6. Start your website and launch the browser of your choice. In the browser, navigate to the NuGet server. It may take a second or two for the page to appear because the database needs to get created during the first run.

If you followed the steps properly then you should see the following page:

image

NuGet

Published at DZone with permission of Michael Ceranski. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • How To Publish and Install DotNet SDK With NuGet

Partner Resources

×

Comments

Loading comments

The comments didn't load

Please try again in a moment.

Likes

Loading

The next likes didn't load. Please try again.

The likes didn't load

Please try again in a moment.

See who liked this

Log in or join DZone for free to see who liked this article.

Log in Join for free
  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook