© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•4y ago•
7 replies
CoreVisional

❔ 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,
namespace Test.Web.Area.Admin.SomeViewModel {
    public class SomeViewModel {
        public List<ModelName> { get; set; }
    }
}
namespace Test.Web.Area.Admin.SomeViewModel {
    public class SomeViewModel {
        public List<ModelName> { get; set; }
    }
}

Then the error appears on "ModelName"
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

The type or namespace name 'Api' could not be found
C#CC# / help
2y ago
The type or namespace name 'IArchivable' could not be found
C#CC# / help
4y ago
❔ Type or namespace IServiceCollection could not be found
C#CC# / help
3y ago