Daily Usage Issues

Getting "The type or namespace name 'Http' does not exist in the namespace 'System.Web'"

Started by MrClyfar on 15,717 views

NCrunch 4.2.0.7

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?

Thanks.
Hi, thanks for sharing this problem.

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:

NCrunch_Console_4.3.0.10.msi
NCrunch_Console_4.3.0.10.zip
NCrunch_GridNodeServer_4.3.0.10.msi
NCrunch_GridNodeServer_4.3.0.10.zip
NCrunch_LicenseServer_4.3.0.10.zip
NCrunch_VS2008_4.3.0.10.msi
NCrunch_VS2010_4.3.0.10.msi
NCrunch_VS2010_4.3.0.10.zip
NCrunch_VS2012_4.3.0.10.msi
NCrunch_VS2012_4.3.0.10.zip
NCrunch_VS2013_4.3.0.10.msi
NCrunch_VS2013_4.3.0.10.zip
NCrunch_VS2015_4.3.0.10.msi
NCrunch_VS2015_4.3.0.10.msi.7z
NCrunch_VS2015_4.3.0.10.zip
NCrunch_VS2017_4.3.0.10.msi
NCrunch_VS2017_4.3.0.10.msi.7z
NCrunch_VS2017_4.3.0.10.zip
NCrunch_VS2019_4.3.0.10.msi
NCrunch_VS2019_4.3.0.10.msi.7z
NCrunch_VS2019_4.3.0.10.zip
Hello.

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.

Jason.
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! :)

Post a reply

Log in to reply.