Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi I'm building a site in Umbraco 9 and I am struggling because I don't have the usual intellisense for IPublishedContent.
Please can you tell me how I get intellisense to work.
I want to be able to do @Model. and see the available properties etc
@Model.
Kind regards
Paul
Hi Paul..
What Models Builder mode are you running? If it is PureLive, it is not expected that you can see the properties from the model in the IDE.
If you run AppData mode, you need to include the files in the project. And then you should have IntelliSense
Ok I will try that, thanks.
How do I change the models builder mode with the appSettings.json?
You can see example in this answer https://our.umbraco.com/forum/umbraco-9/105870-umbraco-9-on-net-core#comment-330183
Thanks but where are the files in the solution that I need to include please? It’s not obvious to me.
Sorry :)
The default path is /umbraco/models But that can be changed on the in the settings too, using the key ModelsDirectory
/umbraco/models
ModelsDirectory
{ "Umbraco": { "CMS": { "ModelsBuilder": { "ModelsMode": "AppData", "ModelsDirectory": "/whatever/path/" } } } }
I've been simply including the files in umbraco/models and setting them to compile. I saw this post and tried setting ModelsDirectory.
I seem to get an error no matter what I put in ModelsDirectory.
Even when I try "ModelsDirectory": "/umbraco/models/" or "ModelsDirectory": "/umbraco/models"
ConfigurationException: Invalid models directory "/umbraco/models/".
Umbraco.Extensions.ModelsBuilderConfigExtensions.GetModelsDirectory(string root, string config, bool acceptUnsafe)
Does the directory need to be a sub-directory of something specific?
I'm just getting to know Umbraco and started straight with version 9.
I had the same issue. For me the solution was to add following format.
"ModelsBuilder": { "ModelsMode": "AppData", "ModelsDirectory": "~/umbraco/models/" }
Also I needed to change the build action for generated classes to "C# compiler" in order to avoid the missing namescapes error.
That has done the trick, thank you
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
How do I get IPublishedContent intellisense to work in the views
Hi I'm building a site in Umbraco 9 and I am struggling because I don't have the usual intellisense for IPublishedContent.
Please can you tell me how I get intellisense to work.
I want to be able to do
@Model.
and see the available properties etcKind regards
Paul
Hi Paul..
What Models Builder mode are you running? If it is PureLive, it is not expected that you can see the properties from the model in the IDE.
If you run AppData mode, you need to include the files in the project. And then you should have IntelliSense
Ok I will try that, thanks.
How do I change the models builder mode with the appSettings.json?
You can see example in this answer https://our.umbraco.com/forum/umbraco-9/105870-umbraco-9-on-net-core#comment-330183
Thanks but where are the files in the solution that I need to include please? It’s not obvious to me.
Sorry :)
The default path is
/umbraco/models
But that can be changed on the in the settings too, using the keyModelsDirectory
I've been simply including the files in umbraco/models and setting them to compile. I saw this post and tried setting ModelsDirectory.
I seem to get an error no matter what I put in ModelsDirectory.
Even when I try "ModelsDirectory": "/umbraco/models/" or "ModelsDirectory": "/umbraco/models"
ConfigurationException: Invalid models directory "/umbraco/models/".
Umbraco.Extensions.ModelsBuilderConfigExtensions.GetModelsDirectory(string root, string config, bool acceptUnsafe)
Does the directory need to be a sub-directory of something specific?
I'm just getting to know Umbraco and started straight with version 9.
I had the same issue. For me the solution was to add following format.
Also I needed to change the build action for generated classes to "C# compiler" in order to avoid the missing namescapes error.
That has done the trick, thank you
is working on a reply...