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
Recently I took a look at Umbraco.ModelsBuilder.Api and I wanted to try and create a separate class library to segregate my models.
I've been following this very helpful guide:
But I'm a bit stuck. It seems as though ModelsBuilder can't find my generated classes which are in their own library. Here's my WebConfig:
<add key="Umbraco.ModelsBuilder.Enable" value="true" />
<add key="Umbraco.ModelsBuilder.ModelsMode" value="Nothing" />
<add key="Umbraco.ModelsBuilder.EnableApi" value="true" />
<add key="Umbraco.ModelsBuilder.ModelsNamespace" value="Umbraco7102.Library.Models"/>
<add key="Umbraco.ModelsBuilder.ModelsDirectory" value="~/Umbraco7102.Library/Models"/>
<add key="Umbraco.ModelsBuilder.AcceptUnsafeModelsDirectory" value="true"/>
/Umbraco7102.Library/Models is where my generated classes are, however I'm being given this message:
The type or namespace name 'Home' does not exist in the namespace 'Umbraco.Web.PublishedContentModels' (are you missing an assembly reference?)
It throws the error on this line:
public class _Page_Views_Home_cshtml : Umbraco.Web.Mvc.UmbracoTemplatePage<ContentModels.Home>
I'm referencing my class library in my Umbraco project, and I've named my generated class builder "UmbracoModels.cs".
Any help would be much appreciated!
The issue is probably in your view.
This is pointing to ContentModels namespace
Can you change your view to start with this statement
Thanks Dave, that was simple... I think I had tunnel vision
I feel like a fool.
No problem...have seen that error myself multiple times.
I noticed something which I think threw me off at first.
It seems ModelsBuilder removes the period in my class library when generating the models, as they turn out like the following:
public partial class File : PublishedContentModel
Even though my builder is in the following namespace:
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted