public static void MakeCompilationOutputRunnable(this ProjectContext context, string outputPath, string configuration)
        {
            context
                .ProjectFile
                .Files
                .GetContentFiles()
                .StructuredCopyTo(context.ProjectDirectory, outputPath)
                .RemoveAttribute(FileAttributes.ReadOnly);

            var exporter = context.CreateExporter(configuration);

            if (context.TargetFramework.IsDesktop())
            {
                exporter
                    .GetDependencies()
                    .SelectMany(e => e.RuntimeAssets())
                    .CopyTo(outputPath);
            }
            else
            {
                exporter
                    .GetDependencies(LibraryType.Package)
                    .WriteDepsTo(Path.Combine(outputPath, context.ProjectFile.Name + FileNameSuffixes.Deps));

                exporter.GetDependencies(LibraryType.Project)
                    .SelectMany(e => e.RuntimeAssets())
                    .CopyTo(outputPath);

                CoreHost.CopyTo(outputPath, context.ProjectFile.Name + Constants.ExeSuffix);
            }
        }
        public static AssemblyLoadContext CreateLoadContext(this ProjectContext context, string configuration = "Debug")
        {
            var exporter = context.CreateExporter(configuration);
            var assemblies = new Dictionary<AssemblyName, string>();
            var dllImports = new Dictionary<string, string>();

            foreach (var export in exporter.GetAllExports())
            {
                // TODO: Handle resource assemblies
                foreach (var asset in export.RuntimeAssemblies)
                {
                    // REVIEW: Should we use the following?
                    // AssemblyLoadContext.GetAssemblyName(asset.ResolvedPath);
                    var assemblyName = new AssemblyName(asset.Name);
                    assemblies[assemblyName] = asset.ResolvedPath;
                }

                foreach (var asset in export.NativeLibraries)
                {
                    dllImports[asset.Name] = asset.ResolvedPath;
                }
            }

            return new ProjectLoadContext(
                assemblies,
                dllImports,

                // Add the project's output directory path to ensure project-to-project references get located
                new[] { context.GetOutputPathCalculator().GetOutputDirectoryPath(configuration) });
        }