Microsoft Visual Studio Enterprise 2019
Version 16.4.3
VisualStudio.16.Release/16.4.3+29709.97
Microsoft .NET Framework
Version 4.8.03761
When NCrunch is building my unit test project, it fails with a bunch of errors pointing to the same problem:
NCrunch: If you are experiencing problems in getting this project to build, have a look at http://www.ncrunch.net/documentation/troubleshooting_project-build-issues
Controllers\api\ClaimControllerTests.cs (3, 22): The type or namespace name 'Http' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)
Controllers\api\ConvictionControllerTests.cs (3, 22): The type or namespace name 'Http' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)
Controllers\api\PricesApiControllerTests.cs (10, 22): The type or namespace name 'Http' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)
Controllers\api\AddressApiControllerTests.cs (7, 22): The type or namespace name 'Http' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)
Clicking on one of the line links in the above output takes me to this line:
using System.Web.Http.Results;
The solution itself builds fine, and I can run the MS test runner to execute all the unit tests without a problem.
One thing I did spot is that the namespace System.Web.Http appears in multiple assemblies:
System.Net.Http.Formatting
System.Web.Http.WebHost
System.Web.Http
It's not clear to me why NCrunch is having a problem here. Is there any information I can pass on that can help?
Does your build system give any warnings that might contain useful information? Usually when a reference gets stripped out, there's some information in the build system to give a clue about this. Would you mind submitting a bug report straight after you've had the build fail? The report might contain something I can use on this side to figure out why it is failing.
If you can produce a sample solution that can recreate the issue, I'd really like to dig into it. You can ZIP up sample code and submit this via the NCrunch contact form.
Finally, I can recommend trying the build below to see if this resolves the issue. The build is targeted towards runtime fixes, but there's a lot going on in the build system .. so you never really know:
I'm really sorry about this, but I did manage to fix the problem and I was going to reply to my own message with the solution. But for some reason I must have forgot to click the "Post" button.
Basically as the unit test project was testing against an MVC api controller, the unit test project needed another NuGet package installed (something like Microsoft.Web.Api.Core the exact name escapes me right now). After I installed that package, NCrunch was happy.
Again, sorry for wasting your time with this issue.
MrClyfar wrote:Hello.
Basically as the unit test project was testing against an MVC api controller, the unit test project needed another NuGet package installed (something like Microsoft.Web.Api.Core the exact name escapes me right now). After I installed that package, NCrunch was happy.
Excellent. I'm happy. There's nothing I need to fix! :)