Setting up the NuGet Development Environment

So you want to hack on NuGet? These notes will help you get your development environment set up correctly so you can work on NuGet using Visual Studio. The lowest supported version is Visual Studio 2015.

Get and Build the code

  1. Install Git. Install Git for Windows and then optionally install TortoiseGit
  2. Clone the repository. From a command prompt, run the following commands in a directory where you want the source code to be placed. This will create a folder named "NuGet.VisualStudioExtension" with the source and switch to the branch where active development happens.

    git clone -b dev https://github.com/NuGet/NuGet.VisualStudioExtension.git
    

After VS2015 has been installed, you would need to:

  1. Uninstall the existing NuGet Extension from Visual Studio.
  2. Download and install the Visual Studio 2015 SDK

To build NuGet.VisualStudioExtension, execute the following steps:

  1. Add the directory of msbuild 14, e.g. C:\Program Files (x86)\MSBuild\14.0\Bin, to PATH
  2. Download the latest version of NuGet.exe, and add its directory to PATH
  3. Start powershell. Create a directory, cd into that directory
  4. Run git clone https://github.com/NuGet/Home.git
  5. Run Home\clone-repos.ps1
  6. Run Home\build-nuget.ps1 -configuration debug -clean . The generated vsix will be NuGet.VisualStudioExtension\src\VsExtension\bin\Debug\NuGet.Tools.vsix.

For more details, please visit the NuGet/Home repository

Setup Debugging for VS2015

To debug the console and UI during development, following these steps:

  1. Launch Visual Studio as Administrator
  2. Make sure that the NuGet Extension is UNINSTALLED from your primary instance of VS so your newly compiled one can load into the experimental instance.
  3. Set the VsExtension project as the startup project
  4. Ensure that you rebuild the VsExtension project.
  5. Now you can run or debug the VsExtension project and this would launch a separate instance of VS2015 (called the Experimental instance) with a copy of the NuGet vsix installed. What you do in this instance don't affect the main VS instance.

Developing NuGet on Linux

The easiest distribution to use is OpenSUSE. Install OpenSUSE 13.2, then follow these steps:

  1. Install Git

    sudo zypper install git
    
  2. Install Mono

    sudo zypper install mono-complete
    
  3. Import Trusted Root Certificates. By default, Mono trusts no one. The NuGet build needs to install some packages from https://www.nuget.org, and without neccessary root certificates this will fail. Run this command to import trusted root certificates from Mozilla's LXR into Mono's certificate store:

    mozroots --sync --import
    
  4. Clone the repository

    git clone https://git01.codeplex.com/nuget
    
  5. Build NuGet Cd to the nuget source code direcotry, run

    ./build.sh
    

    This will build NuGet.exe in directory src/CommandLine/bin/Release successfully.