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.
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.
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?
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.
@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!
ModelsBuilder Dll Mode @Model.PropertyNameHere Fail
...
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...?
Regards, Magnus
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 namedHomeHeroImage
with a capitalH
.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?
Regards, Magnus
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...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.