Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Problem with Moq

Discussion in 'Scripting' started by doutho, Apr 28, 2019.

  1. doutho

    doutho

    Joined:
    Sep 11, 2013
    Posts:
    7
    Hello there people,

    I am trying to add the Moq library to obviously do some mocking in my project.

    I downloaded the nuget package with Rider.

    But then when i try to use Moq and i include the using Moq; after some seconds Unity removes the reference from the project references.

    I have tested so many things to check why this is happening. But really i do not have any clue and i cannot find anything relevant on the web.

    Anyone knows why this may be happening?
     
  2. palex-nx

    palex-nx

    Joined:
    Jul 23, 2018
    Posts:
    1,745
    Put the library dll file to the Plugins folder. You can't ref external dlls because there are platforms where there's no external dlls available.
     
  3. HelloCuriosity

    HelloCuriosity

    Joined:
    Sep 23, 2019
    Posts:
    2
    Hey everyone, I too encountered this issue and wasn't happy with the answers that are floating around the web. Manually copy and pasting dlls is time consuming and when you update then you have to copy and paste again and again... You can easily remedy this issue by creating a symlink from your Rider Packages folder to the Unity Plugins folder, no need to manually past your dlls and you can use the NuGet support that comes with Rider ;) Oh the power of ingenuity :cool:

    example:
    ln -s /path-to-unity-project/Packages /path-to-unity-project/Assets/Plugins