Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

NCrunch stuck with building icon next to project and says "build failed"
arunsudhir
#1 Posted : Friday, August 15, 2014 8:59:28 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 8/15/2014(UTC)
Posts: 1
Location: United States of America

My NCrunch got stuck trying to build a test project and then does nothing from then on. But it manages to say in the "NCrunch Tests" pane that "Build failed for 1 project", but doesn't show a red X and a black "B" next to that project.

I did an MSBuild with verbosity set to Detailed and found that I had a SharePoint.Client dll which had two conflicting versions : 16.0.0.0 in GAC and 15.0.0.0 in my references for the csproj.

I managed to solve the problem by switching my base workspace path to E:\NCrunch and E:\ was the root drive for my project as well.

Does NCrunch choose the GAC version over the csproj referenced version in case of conflict? I have found NCrunch to not like conflicting dlls in the past with some of my projects as well and when I resolved the conflicts, they'd build fine.

Can a developer please shed some light on what's happening under the covers here?
Remco
#2 Posted : Saturday, August 16, 2014 12:17:43 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,144

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
Hi, thanks for sharing this issue.

NCrunch is heavily dependent on the assembly resolution logic inside the CLR and MSBuild. Unfortunately, the rules that govern assembly resolution for both of these platforms are very complex. This makes it difficult to know exactly how the build or test appdomain will behave in every situation, as there is no reliable way to 'force' MSBuild/CLR to use a specific assembly. NCrunch tries, but there is too much implicit logic for this to be completely reliable.

When resolving any assembly reference, the CLR's first preference is always to attempt to load this assembly from the GAC. This will override all other forms of referencing. In your case, I suspect it's likely that the reference from your project to the SharePoint DLL wasn't specifying a strong preference for the version of the DLL. This meant that MSBuild was just taking its first preference, which would later conflict with other assembly references downstream in the build process. The natural solution is to try and be consistent with how you reference DLLs and to make sure you specify the version where there may be ambiguity.

It is unfortunate that NCrunch needs to sit on top of platforms that exhibit such a range of behaviour. The techniques used by NCrunch to allow it to build projects in isolation can sometimes make subtle changes in the way that the build executes when compared with a normal VS build of your solution. It's rare that these differences cause serious problems, but sometimes you do get things floating to the surface in the NCrunch build that the VS build won't have flagged up - and vice versa.

If you'd like to take a look at the changes that NCrunch has made to a project in order to build, just right click on any of your projects in the Tests Window, then go to Advanced->Browse to workspace. You should be able to find the .proj file inside the generated workspace, which will have a few modifications. Just open this in your favourite text editor to see what NCrunch has done to the file. It should also be possible to build the file yourself using a command-line MSBuild action if you want to tinker with it (although you will need to reset the engine if you make changes to the file).
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.030 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download