Peter
Peter

Reputation: 2261

AspNetCore namespace doesnt exist

I'm following this course to learn ASP.NET Core.

I did exactly as they did, I can type dotnet new and dotnet restore. I also installed the dotnetcore 1.0.1 SDK preview.

All seems fine, and I should be able to type

using Microsoft.AspNetCore.Http;

But the only things recognized after Microsoft are cSharp, visualbasic and win32?

Here is my project.json file:

 {
   "version": "1.0.0-*",
   "buildOptions": {
   "debugType": "portable",
   "emitEntryPoint": true
  },
  "dependencies": {},
  "frameworks": {
   "netcoreapp1.0": {
    "dependencies": {
    "Microsoft.NETCore.App": {
      "type": "platform",
      "version": "1.0.1"
    },
    "Microsoft.AspNet.WebApi": "5.2.3",
    "Microsoft." **<< i cannt type AspNetCore here**
    },
   "imports": "dnxcore50"
   }
 }

There is no Microsoft."AspNetCore". The only things I do have starting with Asp are:

Upvotes: 2

Views: 5105

Answers (1)

Nate Barbettini
Nate Barbettini

Reputation: 53600

The code completion doesn't always work when editing the project.json file, especially if you're using a lighter editor like VS Code. (Sometimes it doesn't work even in full-blown Visual Studio).

If this happens, don't worry! You can still install any packages you need. Find packages by searching on NuGet and then edit the dependencies section like this:

"PackageName": "1.0.0"   # Version from package details on NuGet

Then, use the dotnet restore command within the project directory to pull down all the packages in project.json.

Upvotes: 2

Related Questions