private static void InitialiseSearchPath(HostType type, bool loadGeneratedAssemblies)
{
string hostTypePrefix = string.Empty;
List<string> hostTypePaths = new List<string>() { "Common" };
switch (type)
{
case HostType.Client:
hostTypePaths.Add("Client");
break;
case HostType.Server:
hostTypePaths.Add("Server");
break;
case HostType.AspNetService:
hostTypePrefix = "bin";
hostTypePaths.Add("Server");
break;
case HostType.AspNetClient:
hostTypePrefix = "bin";
hostTypePaths.Add("Client");
hostTypePaths.Add("Server");
break;
case HostType.All:
hostTypePaths.Add("Client");
hostTypePaths.Add("Server");
break;
case HostType.None:
default:
break;
}
foreach (var path in hostTypePaths)
{
var pathWithPrefix = string.IsNullOrWhiteSpace(hostTypePrefix)
? path
: Path.Combine(hostTypePrefix, path);
var rootedPath = QualifySearchPath(pathWithPrefix);
Log.DebugFormat("Added searchpath [{0}]", rootedPath);
AssemblyLoader.SearchPath.Add(Path.Combine(rootedPath, loadGeneratedAssemblies ? "Generated" : "Fallback"));
AssemblyLoader.SearchPath.Add(rootedPath);
}
AssemblyLoader.SearchPath.Add(Path.Combine(QualifySearchPath(hostTypePrefix), loadGeneratedAssemblies ? "Generated" : "Fallback"));
}