I had a working MVC application when I decided that it was time for some maintenance. My views were all under SHARED directory and I decided to move them into separate directories.
I implemented a CustomViewEngine that I found here: Can I specify a custom location to "search for views" in ASP.NET MVC?
View structure looks something like this
Views
AppViews
OtherAppViews
...
Shared
...
This is an error that I am getting:
The view at '~/Views/AppViews/SomeView.cshtml' must derive from ViewPage,
ViewPage<TModel>, ViewUserControl, or ViewUserControl<TModel>.
I tried to inherit from @inherits System.Web.Mvc.WebViewPage
(as explained here: The view must derive from WebViewPage, or WebViewPage<TModel>) , but when I do this I get an error saying that I can't use @inherits
and @model
at the same time.
Your CustomEngine should derive from RazorViewEngine
instead of WebFormViewEngine
since you use .cshtml files (Razor engine).
Docs:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With