Build/Test Issues

After removing a failing project from the solution, it does not disappear from NCrunch

Started by abelb on 5,568 views

The project that I removed from the *.sln file is failing its build and I don't know (and don't care) how to make it work, so I removed it from the solution as there were no dependencies anymore. But NCrunch didn't remove it.

I think I tried everything, including running the VS2015 Setup to repair Visual Studio. I used an old trick to force-reload everything (by changing the general settings of the NCrunch configuration), but this didn't help. I changed the build configuration(s) multiple times (per project, unfortunately, so a lot of work) and checked manually whether any (hidden) references to my old project still existed.

The weirdest thing: when I load this solution and start NCrunch, it says "Loading project 1 of 14" etc. But at the end it says "Loading project 15 of 14".

External image

In the NCrunch configuration window, the project is not listed.

If I rightclick the project in NCrunch and select Ignore Selected Tests, nothing happened. I tried to find a different option to ignore a certain component completely (is there such an option?), but couldn't find it.

I have to admit, I am still on a rather old version of NCrunch (2.16). I'll first remove the cached project files of NCrunch, but I hope that when I upgrade this project would also disappear.

Edited

NCrunch discovers projects in two ways:

1. From the solution itself (i.e. sln file or reported from VS)
2. By traversing project references from other projects it has loaded

When projects are discovered using '2', this will throw out NCrunch's expected project count in the initialisation counter.. So you'll see the strange 15 out of 14. As funny as this looks, it is actually by design - NCrunch expected to load 14 projects, but ended up needing to load 15 because of project dependencies.

The problem you're experiencing is likely because you still have a project in your solution that references the project you removed. NCrunch is finding this reference at load time and loading the removed project anyway.

This behaviour is the same for the current version as it is for 2.16. If you've been hit with an internal issue of some kind, clearing out the cache file will often fix it. Upgrading to the latest version of NCrunch will refresh the cache file anyway, so there is no need to delete it if you upgrade.
Hi Remco,

You just beat me to it. Visual Studio wasn't showing _any_ reference to it in any of the projects (and it builds fine). But then I found the culprit, I had a line like the following in one fsproj file:

<When Condition=" $(Configuration.EndsWith('_ICU')) or '$(NCrunch)' == '1' ">
    <ProjectReference Include="..\..\Path-to-ICU-prj\Xxx.ICU.vcxproj">
    <!-- some more -->
</When>


Not sure why, at any given time in the history of this project, I added that when-condition, it should never have been there, I think.

Clearly, that line created a difference in loaded projects between Visual Studio (there are no "_ICU" configurations anymore) and NCrunch. Removing it solved the problem at once. Thanks for your fast reply. Now on to upgrading, I read you added a lot of cool features! :)
Interestingly, it shows a small bug of NCrunch (which may or may not be present in the current release). If you have a reference like the one shown above, with the $(NCrunch) variable, it is odd that the same reference is not shown in the NCrunch Configuration window. Apparently, the NCrunch Tests window and the NCrunch Configuration window use different heuristics to find the project references.
abelb wrote:Interestingly, it shows a small bug of NCrunch (which may or may not be present in the current release). If you have a reference like the one shown above, with the $(NCrunch) variable, it is odd that the same reference is not shown in the NCrunch Configuration window. Apparently, the NCrunch Tests window and the NCrunch Configuration window use different heuristics to find the project references.


Interesting. Are you saying that the project is not shown in the configuration window, but it IS shown in the Tests Window? I think there may be a known problem related to this.

Post a reply

Log in to reply.