It looks as if your ContentModels namespace might be incorrect - when I use appdata I usually put my models in a separate "core" class library and I will usually get something like:
Actually I think I've had something like this happen in Visual Studio myself - it sometimes gives loads of errors in the view about namespaces like "System" not being found; usually I can fix it by closing and re-opening the project.
And seems it is a reason why Intellisense doesn't see it, models not compiled at all.
The reason I did manual changes in including settings, I wanted my generated models includes automatically to a solution. But it seems VS causes errors when you start to manipulate that folder with UI then.
Intellisense does't recognize models with ModelsBulder AppData mode
Umbraco 8.6.1, Models Builder embedded
I using
AppData
mode for the first time after a long time ofDll
mode usage.For some reason, Intellisense doesn't recognize any models, whatever I do.
For example, here is a regular
HomePage
model, it was included in the project:And commonly used in the view:
Intellisense doesn't see it and I get compilation errors :(
What may be wrong?
Hi Dmitry
It looks as if your ContentModels namespace might be incorrect - when I use appdata I usually put my models in a separate "core" class library and I will usually get something like:
In my views - so I would check the namespace in your HomePage.generated.cs class.
I didn't change the standard namespace, it is
Umbraco.Web.PublishedModels
App_Data/Models/HomePage.generated.cs content:
Actually I think I've had something like this happen in Visual Studio myself - it sometimes gives loads of errors in the view about namespaces like "System" not being found; usually I can fix it by closing and re-opening the project.
What happens if you change the first line to
?
I think this can also happen if the namespace isn't specified in the web.config file in the Views directory - something like this should be in there:
(Can't get the editor to show the whole thing, but
Should be in the namespaces element)
Nope, didn't help :(
Checked, has it in /Views/Web.config :(
Got it!
As a result of VS solution including manipulations (manually too), that node missed from project config (
YourUmbracoProjectName.csproj
):And seems it is a reason why Intellisense doesn't see it, models not compiled at all.
The reason I did manual changes in including settings, I wanted my generated models includes automatically to a solution. But it seems VS causes errors when you start to manipulate that folder with UI then.
So, here is a solution:
Just add ModelsBuilder folder settings
Models will be generated to
App_Code/Models
folder that compiles automatically. I don't sure about performance, but it solves the problem.is working on a reply...