Merge pull request #1738 from dotnet/nimullen/createloadcontextfix

Add ability to specify `outputPath` when creating a `ProjectContext`s `AssemblyLoadContext`.
This commit is contained in:
N. Taylor Mullen 2016-03-07 14:38:35 -08:00
commit 2f2b3df35b

View file

@ -10,7 +10,10 @@ namespace Microsoft.DotNet.ProjectModel.Loader
{
public static class LoaderProjectContextExtensions
{
public static AssemblyLoadContext CreateLoadContext(this ProjectContext context, string configuration = "Debug")
public static AssemblyLoadContext CreateLoadContext(
this ProjectContext context,
string configuration = "Debug",
string outputPath = null)
{
var exporter = context.CreateExporter(configuration);
var assemblies = new Dictionary<AssemblyName, string>(AssemblyNameComparer.OrdinalIgnoreCase);
@ -38,7 +41,7 @@ namespace Microsoft.DotNet.ProjectModel.Loader
dllImports,
// Add the project's output directory path to ensure project-to-project references get located
new[] { context.GetOutputPaths(configuration).CompilationOutputPath });
new[] { context.GetOutputPaths(configuration, outputPath: outputPath).CompilationOutputPath });
}
private class AssemblyNameComparer : IEqualityComparer<AssemblyName>