Add support for .config file generation for test projects
This commit is contained in:
parent
1e423d4f1b
commit
b02dbc45f4
8 changed files with 97 additions and 7 deletions
|
@ -332,8 +332,10 @@ namespace Microsoft.DotNet.Tools.Compiler
|
|||
success &= GenerateCultureResourceAssemblies(context.ProjectFile, dependencies, outputPath);
|
||||
}
|
||||
|
||||
bool generateBindingRedirects = false;
|
||||
if (success && !args.NoHostValue && compilationOptions.EmitEntryPoint.GetValueOrDefault())
|
||||
{
|
||||
generateBindingRedirects = true;
|
||||
var rids = PlatformServices.Default.Runtime.GetAllCandidateRuntimeIdentifiers();
|
||||
var runtimeContext = ProjectContext.Create(context.ProjectDirectory, context.TargetFramework, rids);
|
||||
runtimeContext
|
||||
|
@ -341,16 +343,22 @@ namespace Microsoft.DotNet.Tools.Compiler
|
|||
}
|
||||
else if (!string.IsNullOrEmpty(context.ProjectFile.TestRunner))
|
||||
{
|
||||
generateBindingRedirects = true;
|
||||
var projectContext =
|
||||
ProjectContext.Create(context.ProjectDirectory, context.TargetFramework,
|
||||
new[] { PlatformServices.Default.Runtime.GetLegacyRestoreRuntimeIdentifier()});
|
||||
|
||||
|
||||
projectContext
|
||||
.CreateExporter(args.ConfigValue)
|
||||
.GetDependencies(LibraryType.Package)
|
||||
.WriteDepsTo(Path.Combine(outputPath, projectContext.ProjectFile.Name + FileNameSuffixes.Deps));
|
||||
}
|
||||
|
||||
if (generateBindingRedirects)
|
||||
{
|
||||
context.GenerateBindingRedirects(exporter, outputName);
|
||||
}
|
||||
|
||||
return PrintSummary(diagnostics, sw, success);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue