@using from my view does not find the model in Asp.Net MVC

Asked

Viewed 111 times

-1

[ @using

Hello friends my name is Wesley I already do program some time (huahuahua) I always use the platform to ask questions but it is the first time I use the platform to ask, I hope you can help me I am creating an application in Asp.net MVC using Visual Studio 2017, I started with the empty template I started modeling my class, my controller but when I go to the view and I look for the List Model "Costs" with @using does not find the following error: "The name of the type or namespace "Costs"can not be found(is missing a using directive or a reference of Assembly)", I have tried to add all possible references assemblies and did not work, since I thank all...

2 answers

0

Before your @model, add the path where this class is in your project, example:

@using Exportation.Models

Also try to rebuild your entire project, and in the last case close and open the visual studio again.

  • I already tried using @using Export.Models before the model List<Costs> in the view but it didn’t work either the view still hasn’t found my class "Costs" I believe I should add a reference in assemblies but I tried to add everything and it wasn’t :(

0

Good afternoon, Wel!

You need to add the namespace of that class in the file _ViewImports.cshtml:

@using Nomedoprojeto.Models.ViewModels

Browser other questions tagged

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