Error The type or namespace name 'Model' could not be found

Asked

Viewed 960 times

1

I’m getting the error message below on instruction @model FuncionarioModel

Error: The type or namespace name 'Funcionaiomodel' could not be found (are you Missing a using Directive or an Assembly Reference?)

@model FuncionarioModel

<form asp-controller="Funcionarios" asp-action="Registro">
</form>

  • Remember to always tell if you are using ASP.NET MVC (classic, .NET Framework) or ASP.NET Core. Also, please post code and error messages in text instead of images, this allows your question to be easily found by the error message and allows people with external domain locks to try to help you =)

1 answer

1

That’s because probably the FuncionarioModel is in a namespace different - I inferred this because it is normal to organize the namespaces in project folders . NET.

In this case, or do you care namespace in a "global" way, using the _ViewImports.cshtml - See more in the documentation:

@using Projeto.Models

Or use the full class name on @model.

@model Models.FuncionarioModel

Browser other questions tagged

You are not signed in. Login or sign up in order to post.