Build/Test Issues

The primary reference could not be resolved (target mismatch)

Started by Momyshka on 9,443 views

Hello!
Newtonsoft.Json is installed via Nuget packages.
<package id="Newtonsoft.Json" version="4.5.11" targetFramework="net40" />

NCrunch shows errors like :''The type or namespace name could not be found (are you missing a using directive or an assembly reference?)
" for project, where Newtonsoft.Json is installed

Also, I see next warnings during build via Ncrunch (and it seemed this is the reason of the NCrunch failure):

"WARNING - C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets: The primary reference "D:\NCrunchWorkFolder\9336\210\WebSite\bin\WebSite.dll" could not be resolved because it has an indirect dependency on the assembly "Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed" which was built against the ".NETFramework,Version=v4.5" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.0".

WARNING - C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets: The primary reference "D:\NCrunchWorkFolder\9336\227\Authentication\bin\Debug\Authentication.dll" could not be resolved because it has an indirect dependency on the assembly "Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed" which was built against the ".NETFramework,Version=v4.5" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.0".

WARNING - C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets: The primary reference "D:\NCrunchWorkFolder\9336\207\Logic\bin\Debug\Logic.dll" could not be resolved because it has an indirect dependency on the assembly "Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed" which was built against the ".NETFramework,Version=v4.5" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.0".
"
and UnitTest project fails to be build via Ncrunch (via VS or Teamcity everything is good)



Any help will be approciate. (i see topic with smth like this, but it was related to old build, 1.0.6.xxxx)

Edited

Hi, thanks for posting!

Does placing NCrunch in compatibility mode resolve this problem?
Yes, it helps. Thanks a lot.

Post a reply

Log in to reply.