private static void VerifyCodebase(Assembly assembly, string filepath)
{
string codebase = assembly.CodeBase.ToLower();
string normalizedPath = filepath.Replace('\\', '/').Replace("//", "/").ToLower();
if (!normalizedPath.StartsWith("file:///"))
{
normalizedPath = "file:///" + normalizedPath;
}
if (codebase != normalizedPath)
{
throw new ApplicationException(String.Format("Duplicate assembly loaded. You need to restart the configuration tool.\r\n{0}\r\n{1}", codebase, normalizedPath));
}
}