How to install Moq framework

This is an old question, but the convenient method I used is not listed here and this is the first result on google. I am using VS 2013 and if I search for Moq in Extensions and Updates there are no results so:

  1. Go to Package Manager Console - (Tools -> Library Package Manager)
  2. Change the default project to your test project
  3. Then type: install-package moq

The best way to add reference to Moq framework is installing it from Nuget. Also you still can download Moq.dll and add reference to this library (usually I create folder libs under the solution folder, where I put all third-party libraries, which is not available via Nuget).

BTW Another option to install package from Nuget - right click on project references and select Manage Nuget packages.... Then search online for Moq and install it. See why use Nuget over installing libraries directly on my machine


There's no need to install it. Just add a reference to the moq.dll in your project.

But of course you can use gacutil to register the library in your global assembly cache.

c:\path> gacutil /i Moq.dll


When using Visual Studio:

  1. Right click on References [It's in the project Explorer]
  2. Manage NuGet Packages
  3. Search for Moq and add it to your solution.