Nuget packages not being found

Chris's Avatar


23 Dec, 2015 10:16 AM

We have a solution with two projects that contain nuget packages.

The first seems to build fine and all packages are installed.

When it starts to build the second one it says:
- All packages listed in XXX\packages.config are already installed.

And then fails immediately with Could not resolve this reference. Could not locate the assembly "Moq, Version=4.2.1507.118, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors

In packages.config for the project we have
  <package id="Moq" version="4.2.1507.0118" targetFramework="net45" />

In the .csproj file
    <Reference Include="Moq, Version=4.2.1507.118, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">

Any ideas?

  1. Support Staff 1 Posted by Feodor Fitsner on 23 Dec, 2015 02:13 PM

    Feodor Fitsner's Avatar

    Hi Chris,
    Try using "nuget restore <relative-path-to-solution.sln>" command in "Before build" section (or before_build in appveyor.yml).


  2. 2 Posted by Chris on 24 Dec, 2015 10:39 AM

    Chris's Avatar

    We've done that. It just seems like it restores some packages and not others. It seems like the list it builds up front is incorrect. Missing nunit and moq but includes other things like IKVM

  3. Support Staff 3 Posted by Feodor Fitsner on 24 Dec, 2015 05:48 PM

    Feodor Fitsner's Avatar

    On your development machine create a new empty folder, do a clean clone of your repo into it and restore from there. Also, try enabling detailed verbosity on "nuget restore" command. Another trick you may try is restoring from packages.config:

  4. Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 02:03 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac