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

Notification

Icon
Error

Getting "The type or namespace name 'Http' does not exist in the namespace 'System.Web'"
MrClyfar
#1 Posted : Friday, January 24, 2020 2:58:33 PM(UTC)
Rank: Member

Groups: Registered
Joined: 8/6/2011(UTC)
Posts: 16

Thanks: 1 times
Was thanked: 2 time(s) in 2 post(s)
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:

Quote:
NCrunch: If you are experiencing problems in getting this project to build, have a look at http://www.ncrunch.net/d...ng_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:

Code:
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.
Remco
#2 Posted : Friday, January 24, 2020 11:26:47 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,420

Thanks: 838 times
Was thanked: 1136 time(s) in 1062 post(s)
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
MrClyfar
#3 Posted : Friday, January 24, 2020 11:59:44 PM(UTC)
Rank: Member

Groups: Registered
Joined: 8/6/2011(UTC)
Posts: 16

Thanks: 1 times
Was thanked: 2 time(s) in 2 post(s)
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.
Remco
#4 Posted : Saturday, January 25, 2020 9:57:01 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,420

Thanks: 838 times
Was thanked: 1136 time(s) in 1062 post(s)
MrClyfar;14392 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! :)
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.064 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download