Model builder code in separate project, how?
# help-with-umbraco
k
What's the easiest way to get the model builder code (the generated classes for doctypes, etc) in a separate project from the Umbraco project? Just configure the model builder output path so it ends up in the correct place?
d
That's pretty much it. You do have to enable an additional flag to allow 'unsafe locations' before it actually works. And you might want to tweak the namespace. You can configure all of those in the appsettings. I don't know the names of each config from the top of my head, but you can find them all very well in the umbraco docs.
a
for our sites, we have a web project and a code project, so we're doing something like this:
Copy code
json
{
  "Umbraco": {
    "CMS": {
      "ModelsBuilder": {
        "ModelsMode": "Nothing",
        "ModelsDirectory": "~/../code/Models/Umbraco",
        "ModelsNamespace": "MySite.Models.Umbraco",
        "AcceptUnsafeModelsDirectory": true
      }
    }
  }
}
k
Worked like a charm. Thanks! This will be my new default.
7 Views