InvalidOperationException: Cannot retrieve property 'Name' because localization failed. Type 'Common.SharedResources' is not public or does not contain a public static string property with the name 'Common_From'.
Hi folks, I have a 'Common' class library project containing a resource file (SharedResources.resx) and an associated class (ShareResources.cs) which is working as expected by localising strings and error messages for a separate 'Web' project, but I can't get the same resources to work with the Display attribute on a view model - requesting the view throws the exception shown above.
Every similar problem I've found online was solved by ensuring the class and resource file are public and the 'Custom Tool' is set to 'PublicResXFileCodeGenerator', however as can be seen below this is already the case, so I'm at a bit of a loss.
View Model (Web) - replacing the key constants with regular strings also throws the exception.
[Display(ResourceType = typeof(SharedResources), Name = ResourceKeys.Value.Common.From)]
public DateTime? FromDate { get; set; }
SharedResources.cs (Common)
public class SharedResources
{
// Intentionally blank.
}
SharedResources.resx (Common)
SharedResources.Designer.cs
SharedResources.resx Properties


