But because the /Models/models.generated.cs file is not included in the project by default nodes using these templates throw errors.
Apologies if I've missed it but shouldn't this be documented somewhere or the model builder not enabled by default if this file can't be include in the nuget package? I can see this confusing people (it confused me at least!).
I'm still new to the modelsbuilder but by default it should be set to "PureLive" mode, which as I understand it, means that models should be generated on the fly without one needing to do anything in order to be able to access the data. This I think is targeted towards those who don't intend to ever opening up Visual Studio in order to work on their Umbraco site.
Not sure whether those files need to be included in the VS project when doing initial builds etc. - I think it should just work out of the box but if you don't change the mode to something else...But I could be wrong here since I'm still a n00b...I just don't recall seeing any error doing a vanlilla Umbraco installation some time ago...So wondering if you modified the configuration to use another mode, which is then the cause of the errors you're seeing?
No, not changing any configs - just a fresh VS solution - nuget in Umbraco and any any new doc types created with a template are created with the model referenced.
When you open these in VS they have the red squigglies because the models.generated.cs file is not included in the solution.
On hover you obviously get (which gives you a clue I guess):
The type or namespace name 'MODELNAME' does not exist in the namespace
'Umbraco.Web.PublishedContentModels' (are you missing an assembly
reference?).
I've no idea if this is easy to do but including this in the project on the nuget install would ensure there's no problem. I say this just because I wasn't sure where to find this and I'm sure others will have this issue.
Not sure it's right to do but I've created an issue.
Umbraco via Visual Studio & Nuget - models.generated.cs not included by default
Hi,
Since the latest version new projects in VS have the model builder enabled by default when installing from Nuget.
Umbraco is creating templates with the model included
But because the /Models/models.generated.cs file is not included in the project by default nodes using these templates throw errors.
Apologies if I've missed it but shouldn't this be documented somewhere or the model builder not enabled by default if this file can't be include in the nuget package? I can see this confusing people (it confused me at least!).
Steve
Hi Steve
If it helps there is some documentation about the models builder (v3+), here https://github.com/zpqrtbnk/Zbu.ModelsBuilder/wiki/Umbraco.ModelsBuilder
I'm still new to the modelsbuilder but by default it should be set to "PureLive" mode, which as I understand it, means that models should be generated on the fly without one needing to do anything in order to be able to access the data. This I think is targeted towards those who don't intend to ever opening up Visual Studio in order to work on their Umbraco site.
Not sure whether those files need to be included in the VS project when doing initial builds etc. - I think it should just work out of the box but if you don't change the mode to something else...But I could be wrong here since I'm still a n00b...I just don't recall seeing any error doing a vanlilla Umbraco installation some time ago...So wondering if you modified the configuration to use another mode, which is then the cause of the errors you're seeing?
/Jan
Hi Jan,
No, not changing any configs - just a fresh VS solution - nuget in Umbraco and any any new doc types created with a template are created with the model referenced.
When you open these in VS they have the red squigglies because the models.generated.cs file is not included in the solution.
On hover you obviously get (which gives you a clue I guess):
I've no idea if this is easy to do but including this in the project on the nuget install would ensure there's no problem. I say this just because I wasn't sure where to find this and I'm sure others will have this issue.
Not sure it's right to do but I've created an issue.
http://issues.umbraco.org/issue/U4-8333
Steve
Actually reading this post
http://www.zpqrtbnk.net/posts/purelive-models-introduction
It suggests you shouldn't include this file.
Steve
is working on a reply...