When running an ASP.NET application on top of .NET 4.5, we encountered the following error:
Either ErrorMessageString or ErrorMessageResourceName must be set, but not both
The strange this was that we only noticed the issue on our test environment. On our local machine the application worked fine.
Luckily an explanation was found on the following blog: http://gunnarpeipman.com/2015/02/either-errormessagestring-or-errormessageresourcename-must-be-set-but-not-both/
It seems that this is a bug in .NET 4.5, as we had .NET 4.6 running on our local machine, it explained that we couldn’t reproduce the issue on our local dev machines.
As a workaround, you can follow the suggestion as mentioned in the post. Add an ‘ErrorMessage=null’ property to your Data Annotation: