Dotnet compile include project dependencies
This commit is contained in:
parent
1576ffeb15
commit
1952e6d972
1 changed files with 26 additions and 0 deletions
|
@ -141,6 +141,32 @@ namespace Microsoft.DotNet.Tools.Compiler
|
|||
nativeArgs.Add("--output");
|
||||
nativeArgs.Add($"\"{outputPath}\"");
|
||||
|
||||
// Dependencies
|
||||
var exporter = context.CreateExporter(configuration);
|
||||
var dependencies = exporter.GetDependencies().ToList();
|
||||
foreach (var dependency in dependencies)
|
||||
{
|
||||
var projectDependency = dependency.Library as ProjectDescription;
|
||||
|
||||
if (projectDependency != null)
|
||||
{
|
||||
if (projectDependency.Project.Files.SourceFiles.Any())
|
||||
{
|
||||
var projectOutputPath = GetProjectOutput(projectDependency.Project, projectDependency.Framework, configuration, outputPath);
|
||||
nativeArgs.Add("-r");
|
||||
nativeArgs.Add($"\"{projectOutputPath}\"");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach(var dep in dependency.RuntimeAssemblies)
|
||||
{
|
||||
nativeArgs.Add("-r");
|
||||
nativeArgs.Add($"\"{dep.ResolvedPath}\"");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Write Response File
|
||||
var rsp = Path.Combine(intermediateOutputPath, $"dotnet-compile-native.{context.ProjectFile.Name}.rsp");
|
||||
File.WriteAllLines(rsp, nativeArgs);
|
||||
|
|
Loading…
Reference in a new issue