Build/Test Issues

Build Fails in NCrunch for depencies but not in VS

Started by Martina on 2,129 views

Hi,

I have a solution with several projects in, of which only one is a test project. The sln builds fine in VS and tests are passing, though NCrunch seems to be stuck looking for dependencies in a different workspace. There are 22 tests failing due to to a build failed.

The file path in bold is not correct. Is there a way for me to reset and restart NCruch in order to get rid of these errors? If by restarting it would find automatically the right workspace
I tried with 'Restart the NCrunch engine and resynchronize with VS and rebuild project' button, on the test window. But nothing changes.

Thank you

System.IO.FileNotFoundException: Could not load file or assembly 'System.Web.Mvc, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
File name: 'System.Web.Mvc, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' ---> System.IO.FileNotFoundException: Could not load file or assembly 'file:///C:\Users\MartinaNatale\AppData\Local\NCrunch\10412\39\_ncrunchreferences\System.Web.Mvc.dll' or one of its dependencies. The system cannot find the file specified.
File name: 'file:///C:\Users\MartinaNatale\AppData\Local\NCrunch\10412\39\_ncrunchreferences\System.Web.Mvc.dll'
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
Hi, thanks for posting.

When NCrunch processes your project, it will shadow copy it into a background workspace and redirect most references in this project to an _ncrunchreferences directory inside that workspace. So the path above doesn't necessarily look wrong, but it's concerning that the file doesn't seem to exist where it's supposed to.

Is there more to the stack trace above that might show which component is attempting to load the assembly?

Can you tell me any more about how your project is referencing the assembly? Is this done via a Nuget package? Is the System.Web.Mvc.dll file referenced from a path under your solution directory?
Thanks for getting back to me.

No, the stack trace hasn't got any more, it keeps going on about Nuget packages missing.
In fact, the references that it keeps looking for are all declared in the csproj file and have been added as references in each project.

I did carry on writing tests with NCrunch disabled for about one hour. Restarted the machine again and VS and it seemed to have forgotten about that file path XD I don't even know if there is a logical explanation, though it is working fine now. Thanks

Post a reply

Log in to reply.