I have a solution with two projects. One is called Resources and is a collection of resource .resx files for localization. The other is an MVC 5 project that has Resources as a reference. I define a new resource in the .resx file called EmailAddress and sure enough it is in Resource.Designer,cs:
internal static string EmailAddress {
get {
return ResourceManager.GetString("EmailAddress", resourceCulture);
}
}
However, when I try to refernce in my Model class it says it doesn't exist:
[Display(Name = "EmailAddress", ResourceType = typeof(Resources.Resources))]
[Required(ErrorMessageResourceType = typeof(Resources.Resources),
ErrorMessageResourceName = "EmailRequired")]
[RegularExpression(".+@.+\\..+", ErrorMessageResourceType = typeof(Resources.Resources),
ErrorMessageResourceName = "EmailInvalid")]
public string EmailAddress { get; set; }
Also, if I try to do this a Razor View, it doesn't show up in the Intellisense:
@Resources.Resources.
What is going on? I should also state that the resource file was originally taken from a sample project and the resources that were in it show up but any I add don't (but its the designer cs file).