Skip to content

Commit

Permalink
Merge pull request #1455 from k15tfu/fix-loading-exe-assemblies-TestA…
Browse files Browse the repository at this point in the history
…ssemblyLoadContext

Probe assemblies with .exe extension when loading from the test assembly's folder in TestAssemblyLoadContext
  • Loading branch information
CharliePoole authored Aug 9, 2024
2 parents 5e16ca2 + 6fec5cf commit 152ce2e
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,14 @@ protected override Assembly Load(AssemblyName name)
// but are not fully specified in test assembly deps.json file. This happens when the
// dependencies reference in the csproj file has CopyLocal=false, and for example, the
// reference is a projectReference and has the same output directory as the parent.
string assemblyPath = Path.Combine(_basePath, name.Name + ".dll");
if (File.Exists(assemblyPath))
foreach (var extension in new string[] { ".dll", ".exe" })
{
loadedAssembly = LoadFromAssemblyPath(assemblyPath);
string assemblyPath = Path.Combine(_basePath, name.Name + extension);
if (File.Exists(assemblyPath))
{
loadedAssembly = LoadFromAssemblyPath(assemblyPath);
break;
}
}

if (loadedAssembly != null)
Expand Down

0 comments on commit 152ce2e

Please sign in to comment.