umbraco / Umbraco.Cloud.Issues

Public issue tracker for Umbraco Cloud
26 stars 2 forks source link

How to get intellisence when Umbraco.ModelsBuilder.Embedded used in conjunction with UaaS.cmd structure. #157

Closed mistyn8 closed 1 year ago

mistyn8 commented 4 years ago

After upgrading to 8.5.1 and thinking we don't use any extended models builder functionality I'm struggling to set up my Solution in visual studio (Core/Web generated from UaaS.cmd) so that the web project has Models Builder Intellisence, and also that a reference/dependency can be created in the Core project.

Any Cloud devOps give some guidance on the bestpractice approach for 8.5.1+ in conjunction with UaaS.Cmd solution setup

kindest regards

nul800sebastiaan commented 4 years ago

We don't currently have any best-practice documentation for using ModelsBuilder with Cloud.

From the top of my head:

UaaS.cmd sets up a Website project for you, which means you will not be able to use the generated models in VS to get intellisense. If you need that you will need to set up the .Web project as a Web Application project, which is a completely manual task.

Alternatively, you can use one of the modes in the Zbu Modelsbuilder and generate your models into the .Core project and enjoy intellisense.

As far as I know, the Website project (.Web) does not ever provide intellisense since it's a Website project and VS does not expect you to put code in there (even in cshtml files). But I could be wrong.

To get more, and probably better (😉) advise, I would recommend you drop you question in the forum instead: https://our.umbraco.com

I'll leave this issue open as a reminder for us to investigate and provide best-practice documentation in the future.

c9mb commented 4 years ago

I haven't yet worked with V8 but certainly with V7 to get intellisense in the .Web project you need to run the ModelBuilder in DLL mode. This will give you intellisense in .cs and .cshtml files but you obviously need to run the ModelBuilder update every time you make a change to the metadata.

mistyn8 commented 4 years ago

@c9mbundy Yes that was exactly the approach we used to take, however, the embedded models builder has removed dll mode. @nul800sebastiaan this worked in the Website Project ;-) @nul800sebastiaan is it not also the case that the embedded models builder removes the functionality to create models in any folder other than the AppData folder of the web project?

Also we have to consider how this interacts with UDA's on cloud, and really they should be the driving force behind models, as if we have admins on dev changing doctypes (producing a commit to pull local) then we can end up with the generated models.dll being out of sync with environments when drawn from the repo.

So really we need a mode that produces a dll for intellisence that is JIT to take account of UDA's that way models are in sync with the enviroment they are on at all times?? There is the start of a discussion around this on the main repo https://github.com/umbraco/Umbraco-CMS/issues/7339 (to save repeating here)

nul800sebastiaan commented 4 years ago

The 8.5.0 docs still list the ModelsDirectory and AcceptUnsafeModelsDirectory if that's what you're after.

https://our.umbraco.com/Documentation/Reference/Templating/Modelsbuilder/configuration

mistyn8 commented 4 years ago

Ah ok, missed that.

So to get UDA's playing nice with EmbeddedModels and intellisence for local VS development...

It's PureLive (via config transform) on Cloud environments, and AppData on local generating a dll for intellisence in a local dll that's not in the repo, and requires manual build models locally by developers after each pull from dev? (does AppData build models work from the back office?) Yet to test that but seems like it might work...

nul800sebastiaan commented 4 years ago

Hi again @mistyn8 - unfortunately we've not been able to prioritize trying out and documenting this workflow yet. We are going to put it on the list of issues to look at in the future when we have some more focus on improving the developer experience.

In the mean time, we're happy for some input from people already using Cloud and ModelsBuilder successfully, make sure to comment on this issue!