New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
V8: models builder generated models - this.Value<type> #4780
Comments
fwiw: i was able to resolve this by updating my projects TargetFramework to .net v4.7.2 as that is what the umbraco8 dlls are compiled against 👍 |
Same issue. Seems like the .Value and .Value extension methods used by ModelsBuilder are in the Umbraco.Web dll and so installing UmbracoCms.Core in the models project isn't sufficient. Solved for now by manually copying the Umbraco.Web dll over to the other project and referencing it, but that's not ideal. |
I
I think that is a solution to a problem I'm not having. I suspect that is because your model builder is targeted to the same project as the main project so once you made the target the correct framework then all was well and of the Umbraco.Web.dll (as referred to by mattbirch) was already present? |
I can confirm this worked for me! I downloaded via nuget. There is a nuget package for it. UmbracoCms.Web |
How about For you @steadygo - it's the same problem, you are missing the assembly reference to Umbraco.Web. It sounds like the problem for everyone is missing references / framework versions. With a new version things are done a bit differently than on v7 and one of the differences is the NEW NuGet package Give it a go, adding it worked for me with the config you mentioned above! 👍 |
Ah perfect, I should have searched Nuget! Thanks @nul800sebastiaan |
Absolutely true. Solved by doing Install-Package UmbracoCms.Web @ the Core Project This is an excellent article https://anotherdevblog.com/2018/07/18/organize-an-umbraco-projects/ that suggests this workaround. |
Fresh install of Umbraco 8.0.0 configured to utilise separate models project fails to find property of
this.Value<type>
in generated models.Reproduction
Fresh Install from UaaS.cmd
Add Umbraco.Web.PublishedContentModels project and configure web.config
Add Nuget for UmbracoCMS.Core and Umbraco.ModelsBuilder and reference System.Web in new project
Add references as appropriate to CORE and WEB
Bug summary
The generated models comprise calls to return values by type, these calls fail to compile with error regarding failure to find definition or extension method for Value
Specifics
Umbraco 8.0.0 downloaded from git repo via UaaS.cmd
UmbracoCms.Core (8.0.0) nuget
Umbraco.ModelsBuilder (8.0.1) nuget
Steps to reproduce
Fresh Install from UaaS.cmd
Add Umbraco.Web.PublishedContentModels project and configure web.config
Add nuget packages UmbracoCms.Core (8.0.0) and Umbraco.ModelsBuilder (8.0.1), add reference to System.Web
Reference new project Umbraco.Web.PublishedContentModels in both core and web projects.
Build, navigate to CMS and publish the content models.
Refresh Umbraco.Web.PublishedContentModels project and include the cs files for File, Image, Folder, Member
Attempt to Build
Expected result
Compiled solution ready to run
Actual result
Failure to compile with errors in generated cs files in Umbraco.Web.PublishedContentModels, E.g.
Error CS1061 'File' does not contain a definition for 'Value' and no extension method 'Value' accepting a first argument of type 'File' could be found (are you missing a using directive or an assembly reference?) Umbraco.Web.PublishedContentModels C:\sg-htdocs\u8-jo\Umbraco.Web.PublishedContentModels\File.generated.cs 53 Active
The text was updated successfully, but these errors were encountered: