I have created a simple element type, with a media picker property.
The auto generated model class generates the below
///<summary>
/// Main Image
///</summary>
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Umbraco.ModelsBuilder.Embedded", "8.14.0")]
[ImplementPropertyType("mainImage")]
public virtual global::Umbraco.Core.Models.MediaWithCrops MainImage => this.Value<global::Umbraco.Core.Models.MediaWithCrops>("mainImage");
I am however getting a compilation error as it is telling me that "MediaWithCrops " does not exist..
As file is autogeneated and updates as new fields are added I am getting I shouldn't be adding in an extra using. Can anyone suggest what I am missing please?
I get same generated code if I use Image Picker of Media Picker?
Am I maybe using the wrong control for selecting images?
I am also having this problem. It is an Umbraco Cloud local site with .Web and .Core projects. References to Umbraco.Core.Models.MediaWithCrops work as expected in the Core project, but in the Web project I can't get Visual Studio to see the class.
I have tried removing references to Umbraco.Core under Dependencies > Assembles in the Core project, and adding the DLL under Add Assembly Reference and selecting the DLL file under the .Core project directory > Bin > Umbraco.Core.dll, but it doesn't change anything.
When I pull up the Properties on the Umbraco.Core reference in my Core project, it shows as version 8.0.0.0, which is the same version that comes up if I hit F12 on a MediaWithCrops reference in the Web project.
Can anyone suggest anything to try? I'm stumped, and currently unable to use the current version of the Media Picker at all.
I figured it out in my case. My .Core project had a package reference to an ancient version of UmbracoCms.Web. Once I updated this, it worked properly.
In the Core project's .csproj file, this was the old line:
RobertFoster Im using something similar but I cant get it to work. Im getting the below error on Umbraco.Media :- System.NullReferenceException: Object reference not set to an instance of an object. at Umbraco.Web.PublishedContentExtensions.Url(IPublishedContent content, String culture, UrlMode mode) in D:\a\1\s\src\Umbraco.Web\PublishedContentExtensions.cs:line 1436 at
MediaWithCrops Model missing?
I have created a simple element type, with a media picker property. The auto generated model class generates the below
I am however getting a compilation error as it is telling me that "MediaWithCrops " does not exist..
As file is autogeneated and updates as new fields are added I am getting I shouldn't be adding in an extra using. Can anyone suggest what I am missing please?
I get same generated code if I use Image Picker of Media Picker? Am I maybe using the wrong control for selecting images?
Fixed - my .Core project had a different version referenced.
Hi Danny, I'm getting the same error for MediaWithCrops. May I please ask how you fixed it?
Example?
I am also having this problem. It is an Umbraco Cloud local site with .Web and .Core projects. References to Umbraco.Core.Models.MediaWithCrops work as expected in the Core project, but in the Web project I can't get Visual Studio to see the class.
I have tried removing references to Umbraco.Core under Dependencies > Assembles in the Core project, and adding the DLL under Add Assembly Reference and selecting the DLL file under the .Core project directory > Bin > Umbraco.Core.dll, but it doesn't change anything.
When I pull up the Properties on the Umbraco.Core reference in my Core project, it shows as version 8.0.0.0, which is the same version that comes up if I hit F12 on a MediaWithCrops reference in the Web project.
Can anyone suggest anything to try? I'm stumped, and currently unable to use the current version of the Media Picker at all.
I figured it out in my case. My .Core project had a package reference to an ancient version of UmbracoCms.Web. Once I updated this, it worked properly.
In the Core project's .csproj file, this was the old line:
Updating it to match the current Umbraco version via NuGet fixed the issue:
It's probably best not to reference the package this way, but removing it broke a lot of stuff, so we'll just update it like shown.
RobertFoster Im using something similar but I cant get it to work. Im getting the below error on Umbraco.Media :- System.NullReferenceException: Object reference not set to an instance of an object. at Umbraco.Web.PublishedContentExtensions.Url(IPublishedContent content, String culture, UrlMode mode) in D:\a\1\s\src\Umbraco.Web\PublishedContentExtensions.cs:line 1436 at
is working on a reply...