❔ The type or namespace name Model could not be found
Hi, I'm facing an error on a missing directive when trying to specify the model name in my view model. I'm not sure if this works on Models directory but it works across controllers and views, so I assume it does. So, I have all my imports called in "_ViewImports", and this includes the model directory. However, when I wanted to use the model name, I get the error. I mean, calling the import inside the view model solves the issue, but I was looking to not include it in since I already have "_ViewImports". For example,
Then the error appears on "ModelName"
6 Replies
I kind of doubt _ViewImports works for controllers because its mainly a razor concept
u didnt give a name to ur property
As for my ViewImports, I already have
Okay it seems like I can't edit the post while on phone, forgot to include the name. Anyways, the error is still there even with the name
maybe you could try
Global Using Directives
insteadHmm, alright. I'll do a double check again on my code first before using global because it seems to work for the other models but not for this specific View Model
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.