Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Hosting the NuGet Gallery Locally in IIS
Note: These instructions are fairly out of date. There is an issue in our backlog to modernize them. The instructions located in our README.md should be sufficient to build and run the gallery locally.
- Ensure IIS is installed with the recommended configuration: http://www.microsoft.com/web/gallery/install.aspx?appid=iis7
- Ensure IIS URL Rewrite Engine is Installed (alternatively please remove that section from the web.config since it is only used for nuget.org).
- Ensure that the .NET Framework 4.5 is installed: http://www.microsoft.com/en-us/download/details.aspx?id=30653
- If you don't have Visual Studio installed, you will need to install the .NET Framework 4.5 Software Development Kit in order to get the reference assemblies: http://msdn.microsoft.com/en-us/windows/desktop/hh852363.aspx (uncheck all other components and install only the .NET Framework 4.5 SDK if you are on Windows 7 or Windows Server 2008/R2)
- Get the source:
git clone firstname.lastname@example.org:NuGet/NuGetGallery.git
- Create a new site in IIS, on port 80 (yes, it must be port 80)
- Ensure the new site's app pool is using .NET 4
- Ensure that app pool's identity has permission to the database specified in web.config (if using integrated security, otherwise just make sure to set the connection string properly).
- Open Visual Studio and open Package Manager Console
- Edit the settings in the Web.config to match your setup, specifically the database connection string and the email settings.
- Ensure that the default project is NuGetGallery and go to the Package Manager Console
- Run the command
Update-Database -ConfigurationTypeName MigrationsConfiguration
- Edit the
Web.Configso that the SMTP settings, gallery owner name, and gallery owner email are set up appropriately. You may also want users to confirm their email addresses.
- Select the Publish command from NuGetGallery and select Custom, enter the details of the server/site you created and publish it OR you can build the site and take the compiled bits and set them up yourself in IIS.
- Test the site by going to the home page
- Test the API by
nuget push <package> -source http://localhost/api/v2/package -apikey <apikey>
If everything works fine, you can register a user and make it an Admin by adding a record to the UserRoles table.
Admin users can view the gallery's error log at http://localhost/elmah.axd