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
@using ContentModels = Umbraco.Web.PublishedModels;
Error: Model does not contain a definition for homeHeroImage...
I've published my models from models builder tab under settings 3 times. My project is targeting 4.7.2 I have the umbraco.web.dll project in my bin. What am I missing? The above worked like a champ in a previous project. Not sure what I'm missing.
Since posting I've figured out that this works:
...but why not
I would probably switch to AppData mode since it would then be easier to look at the generated models...?
What mode are you using? Is it PureLive?
What tool are you using to edit your views? Is it Visual Studio with Intellisense, or the Umbraco backoffice, or something else?
From your code, I understand that the property alias is homeHeroImage. Now, Models Builder generates property names that sort of respect the C# coding style. Therefore, the property is quite possibly named HomeHeroImage with a capital H.
Can you try that?
@Stephen I'm using Dll mode in VS 2019.
Oddly, I closed VS down yesterday at the end of my work day. Opened it this morning and the Model.HomeHeroImage is showing up in intellisense.
Thanks for your reply!!
Having the exact same issue today. Add a property to an existing DocType, Generate Models, and cannot use @Model.PropertyAlias Surely, I don't have to close and reopen VS 2019 every time I add a new property to a DocType. What am I missing?
Maybe Visual Studio doesn't notice the DLL being updated?
But since you're using Visual Studio, why not use API or AppData/LiveAppData mode?
No idea why VS would not pick changes in the DLL when it's re-generated. Will try to reproduce. But yes, if you are using VS, it would be simpler to use the API / extension.
Alright, I'm going to try the API/extension route. But, I'm getting this error "cannot find custom tool UmbracoModelsBuilder on this system" when I do these steps.
The custom tool is deprecated in favor of the extension. See this blog post: https://www.zpqrtbnk.net/posts/models-builder-extension/
Well get there ;)
@Stephen...thank you sir! I was using the extension with the Custom Tool documentation. Thanks for pointing me to the extension documentation. You're the man!
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted