ok, so the errors can vary when you got this message. My problem was that I had EF 5 installed and the other project which I had referenced had 4.4 and there was a conflict. Executing this code in the exception block will help you get the exact message:
using System.IO;
using System.Reflection;
try
{
//The code that causes the error goes here.
}
catch (ReflectionTypeLoadException ex)
{
StringBuilder sb = new StringBuilder();
foreach (Exception exSub in ex.LoaderExceptions)
{
sb.AppendLine(exSub.Message);
if (exSub is FileNotFoundException)
{
FileNotFoundException exFileNotFound = exSub as FileNotFoundException;
if(!string.IsNullOrEmpty(exFileNotFound.FusionLog))
{
sb.AppendLine("Fusion Log:");
sb.AppendLine(exFileNotFound.FusionLog);
}
}
sb.AppendLine();
}
string errorMessage = sb.ToString();
//Display or log the error based on your application.
}
Originally written in this post: Error message 'Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.'