3

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?

1
  • Please don't force tags into question title, its sufficient if you put them in the tags section stackoverflow.com/help/tagging Commented Nov 15, 2016 at 21:40

1 Answer 1

6

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.

Sign up to request clarification or add additional context in comments.

5 Comments

Where in the AspNetCore architecture does the Web assembly lie?
Nowhere, it does not exists in the new ASP.NET Core architecture. See: learn.microsoft.com/en-us/aspnet/core.
Is this a bug then? If it doesn't exist, then I shouldn't be getting this error with a completely virgin new project. If it is a bug...I wonder how I resolve this
no, with dotnet core you may create applications / libraries for different frameworks, e.g. also the full .net framework. in that situation is correct to be able to reference system.web. but in your case you are only referring to asp.net core and there that library does not exist. learn.microsoft.com/en-us/dotnet/articles/standard/library
No, it's not a bug. You've added the reference to System.Web yourself, and that's causing the error you're seeing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.