0

I'm using visual studio 2015 update 3 in the project and have downloaded the project from source control to my local repository.

The problem is when i try to restore the packages it outputs below error

PATH=.\node_modules\.bin;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Web\External;%PATH%;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Web\External\git
C:\Program Files\dotnet\dotnet.exe restore "C:\Users\XXXX\XXXX\XXXX\.vs\restore.dg"
log  : Restoring packages for C:\Users\\XXXX\XXXX\XXXX\project.json...
error: Unable to resolve 'moq.netcore (>= 4.4.0-beta8)' for '.NETFramework,Version=v4.5.2'.
log  : Lock file has not changed. Skipping lock file write. Path: C:\Users\XXXX\XXXX\XXXX\project.lock.json
log  : C:\Users\\XXXX\XXXX\XXXX\ABC.xproj
log  : Restore failed in 1392ms.
Errors in C:\Users\XXXX\XXXX\XXXX\ABC.xproj
    Unable to resolve 'moq.netcore (>= 4.4.0-beta8)' for '.NETFramework,Version=v4.5.2'.

Is this to do with version of Nuget not compatible with .net framework 4.5.2?

Any suggestions would be of great help.

Thank you

Ramu
  • 343
  • 1
  • 6
  • 21
  • 1
    Please let me know if my answer helpful below – Salomon Zhang Nov 21 '17 at 01:26
  • Looks like the project is set to build against target framework v4.5.2. Verify that you are having the correct Target Framework set . Make sure that moq.netcore 4.4.0-beta8 supports v4.5.2. Also this link might be helpful : https://stackoverflow.com/questions/39843015/getting-could-not-load-file-or-assembly-system-core-version-4-0-0-0-while-d/40090790#40090790 – Rajesh Nov 21 '17 at 16:25
  • @SalomonZhang i have tried your solutions, it didn't work in my case. However it might be help others. – Ramu Nov 23 '17 at 10:39
  • @Rajesh the project works fine with .Net framework 4.5.2 and moq.netcore 4.4.0-beta8. Something might have went wrong. I had to reinstall moq.netcore 4.4.0-beta8 and with restart of VS, it's all working now. Thank you – Ramu Nov 23 '17 at 10:41

1 Answers1

0

Have you set your target framework correctly?

And also remember to update .NET Core app package reference in your ABC.csproj

<PackageReference Update="Microsoft.NETCore.App" Version="x.x.xxx" />
Salomon Zhang
  • 1,553
  • 3
  • 23
  • 41
  • Apologies for the delay. I had to re-install moq.netcore from Nuget and restarted VS 2015. This fixed the issue. Thank you for your time. – Ramu Nov 23 '17 at 10:37