Dudemanword
Dudemanword

Reputation: 704

Type or Namespace name Web does not exist in the namespace system

I have been screwing around with .NET Core 1.0.1. I am just trying to get a Hello World page up and running. During the build, I ran into the following error:

The type or namespace name 'Web' does not exist in the namespace 'System' (are you missing an assembly reference?)

I tried adding the reference to my project.json:

  "dependencies": {
    "Microsoft.NETCore.App": {
      "version": "1.0.1",
      "type": "platform"
    },
    "Microsoft.AspNetCore.Mvc": "1.0.1",
    "Microsoft.AspNetCore.Routing": "1.0.1",
    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
    "Microsoft.AspNetCore.Server.Kestrel": "1.0.1",
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
    "Microsoft.Extensions.Configuration.FileExtensions": "1.0.0",
    "Microsoft.Extensions.Configuration.Json": "1.0.0",
    "Microsoft.Extensions.Logging": "1.0.0",
    "Microsoft.Extensions.Logging.Console": "1.0.0",
    "Microsoft.Extensions.Logging.Debug": "1.0.0",
    "Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
    "Microsoft.AspNetCore.StaticFiles": "1.0.0",
    "System.Web": "4.0.0" //Right here
  }

But I get the error: The dependency System.Web >= 4.0.0 could not be resolved. It does not appear I can add the reference normally as in a C# console/dll library.

Is there another package I need to install that actually contains the system.web assembly? Or is there a way to manually add this reference?

Upvotes: 3

Views: 14909

Answers (1)

Henk Mollema
Henk Mollema

Reputation: 46641

In .NET Core, and specifically ASP.NET Core, there is no System.Web anymore. All ASP.NET components live in the Microsoft.AspNetCore.* and Microsoft.Extensions.* namespaces.

For example, HttpContext lives in Microsoft.AspNetCore.Http and Controller in Microsoft.AspNetCore.Mvc.

I suggest you read into the fundamentals of ASP.NET Core.

Upvotes: 6

Related Questions