Search code examples
c#asp.net-corevisual-studio-2005

ASP.NET Core View error in Microsoft Tutorial


Following this Microsoft Tutorial on ASP.NET Core web app I'm getting the following error:

The type or namespace name 'EFGetStarted.AspNetCore.NewDb' could not be found (are you missing a using directive or an assembly reference?)

Note: EFGetStarted.AspNetCore.NewDb is the name of the project and it appears in the intellisense but the .Models.Blog part does not appear in the intellisense.

A portion of the view is shown below. The entire view can be seen in the above link. The error occurs in the first line of the view. I even tried @using EFGetStarted.AspNetCore.NewDb.Models as a first line of the view but still the same error. What I or the Tutorial is missing? I've carefully checked the spellings and just copied/pasted the code from the tutorial to make sure the spellings are correct:

@model IEnumerable<EFGetStarted.AspNetCore.NewDb.Models.Blog>

@{
    ViewBag.Title = "Blogs";
}

<h2>Blogs</h2>

........

I'm using the latest version of ASP.NET Core 1.0 and VS2015-Update 3 [released on June 27, 2016] on Windows 8.1


Solution

  • Whenever you get exception like are you missing a using directive or an assembly reference?, Go to the model class, copy the namespaces and write @using namespaces. This helps to resolve namespaces issues.