16 string[] explicitVariables =
18 "ULSALGORITHMS_XPRESS_OPTIMIZER_ASSEMBLY",
19 "LOTSIZING_XPRESS_OPTIMIZER_ASSEMBLY"
22 foreach (
string variableName
in explicitVariables)
25 Environment.GetEnvironmentVariable(
31 if (File.Exists(explicitPath))
33 return Path.GetFullPath(explicitPath);
37 string xpressDirectory =
38 Environment.GetEnvironmentVariable(
39 "XPRESSDIR")?.Trim() ??
42 if (!
string.IsNullOrWhiteSpace(xpressDirectory))
69 foreach (
string candidate
in candidates)
71 if (File.Exists(candidate))
73 return Path.GetFullPath(candidate);
86 out
string resolvedPath)
88 resolvedPath =
string.Empty;
91 AppDomain.CurrentDomain
96 assembly.GetName().Name,
98 StringComparison.OrdinalIgnoreCase));
100 if (loaded is not
null)
103 string.IsNullOrWhiteSpace(loaded.Location)
113 if (!
string.IsNullOrWhiteSpace(path))
117 return AssemblyLoadContext.Default
118 .LoadFromAssemblyPath(path);
124 Assembly.Load(
"Optimizer");
127 string.IsNullOrWhiteSpace(assembly.Location)