diff --git a/src/Microsoft.AspNetCore.Blazor.Build/Cli/Commands/BuildIndexHtmlCommand.cs b/src/Microsoft.AspNetCore.Blazor.Build/Cli/Commands/BuildIndexHtmlCommand.cs index ddbda6d7af..2d8efaafc6 100644 --- a/src/Microsoft.AspNetCore.Blazor.Build/Cli/Commands/BuildIndexHtmlCommand.cs +++ b/src/Microsoft.AspNetCore.Blazor.Build/Cli/Commands/BuildIndexHtmlCommand.cs @@ -15,9 +15,9 @@ namespace Microsoft.AspNetCore.Blazor.Build.Cli.Commands "Path to the HTML Page containing the Blazor bootstrap script tag.", CommandOptionType.SingleValue); - var references = command.Option("--reference", - "The path from the _bin folder to a given referenced dll file (typically just the dll name)", - CommandOptionType.MultipleValue); + var referencesFile = command.Option("--references", + "The path to a file that lists the paths to given referenced dll files", + CommandOptionType.SingleValue); var embeddedResourcesFile = command.Option("--embedded-resources", "The path to a file that lists the paths of .NET assemblies that may contain embedded resources (typically, referenced assemblies in their pre-linked states)", @@ -37,7 +37,7 @@ namespace Microsoft.AspNetCore.Blazor.Build.Cli.Commands command.OnExecute(() => { if (string.IsNullOrEmpty(mainAssemblyPath.Value) || - !clientPage.HasValue() || !references.HasValue() || !outputPath.HasValue()) + !clientPage.HasValue() || !referencesFile.HasValue() || !outputPath.HasValue()) { command.ShowHelp(command.Name); return 1; @@ -45,6 +45,10 @@ namespace Microsoft.AspNetCore.Blazor.Build.Cli.Commands try { + var referencesSources = referencesFile.HasValue() + ? File.ReadAllLines(referencesFile.Value()) + : Array.Empty(); + var embeddedResourcesSources = embeddedResourcesFile.HasValue() ? File.ReadAllLines(embeddedResourcesFile.Value()) : Array.Empty(); @@ -52,7 +56,7 @@ namespace Microsoft.AspNetCore.Blazor.Build.Cli.Commands IndexHtmlWriter.UpdateIndex( clientPage.Value(), mainAssemblyPath.Value, - references.Values.ToArray(), + referencesSources, embeddedResourcesSources, linkerEnabledFlag.HasValue(), outputPath.Value()); diff --git a/src/Microsoft.AspNetCore.Blazor.Build/Cli/Commands/ResolveRuntimeDependenciesCommand.cs b/src/Microsoft.AspNetCore.Blazor.Build/Cli/Commands/ResolveRuntimeDependenciesCommand.cs index 4a892f2872..e749713c42 100644 --- a/src/Microsoft.AspNetCore.Blazor.Build/Cli/Commands/ResolveRuntimeDependenciesCommand.cs +++ b/src/Microsoft.AspNetCore.Blazor.Build/Cli/Commands/ResolveRuntimeDependenciesCommand.cs @@ -2,6 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; +using System.IO; using Microsoft.Extensions.CommandLineUtils; namespace Microsoft.AspNetCore.Blazor.Build.Cli.Commands @@ -10,9 +11,9 @@ namespace Microsoft.AspNetCore.Blazor.Build.Cli.Commands { public static void Command(CommandLineApplication command) { - var references = command.Option("--reference", - "Full path to a referenced assembly file", - CommandOptionType.MultipleValue); + var referencesFile = command.Option("--references", + "The path to a file that lists the paths to given referenced dll files", + CommandOptionType.SingleValue); var baseClassLibrary = command.Option("--base-class-library", "Full path to a directory in which BCL assemblies can be found", @@ -36,9 +37,13 @@ namespace Microsoft.AspNetCore.Blazor.Build.Cli.Commands try { + var referencesSources = referencesFile.HasValue() + ? File.ReadAllLines(referencesFile.Value()) + : Array.Empty(); + RuntimeDependenciesResolver.ResolveRuntimeDependencies( mainAssemblyPath.Value, - references.Values.ToArray(), + referencesSources, baseClassLibrary.Values.ToArray(), outputPath.Value()); diff --git a/src/Microsoft.AspNetCore.Blazor.Build/targets/Blazor.MonoRuntime.targets b/src/Microsoft.AspNetCore.Blazor.Build/targets/Blazor.MonoRuntime.targets index f428a76e9d..7061f7cfde 100644 --- a/src/Microsoft.AspNetCore.Blazor.Build/targets/Blazor.MonoRuntime.targets +++ b/src/Microsoft.AspNetCore.Blazor.Build/targets/Blazor.MonoRuntime.targets @@ -24,12 +24,12 @@ - + <_BlazorResolveReferencesDidRun>true - + >/<>/blazor/inputs.copylocal.txt --> $(BlazorIntermediateOutputPath)inputs.copylocal.txt - + $(BlazorIntermediateOutputPath)inputs.linkerswitch.cache @@ -236,6 +236,9 @@ $(BlazorIntermediateOutputPath)inputs.index.cache + + $(BlazorIntermediateOutputPath)references.txt + $(BlazorIntermediateOutputPath)embedded.resources.txt @@ -279,7 +282,7 @@ File="$(BlazorBuildCommonInputsCache)" Overwrite="True" WriteOnlyWhenDifferent="True" /> - + - - - + + + @@ -472,10 +475,10 @@ <_CollectResolvedAssembliesDependsOn> - _ResolveBlazorApplicationAssemblies; - _ReadResolvedBlazorApplicationAssemblies; - _IntermediateCopyBlazorApplicationAssemblies; - _TouchBlazorApplicationAssemblies + _ResolveBlazorApplicationAssemblies; + _ReadResolvedBlazorApplicationAssemblies; + _IntermediateCopyBlazorApplicationAssemblies; + _TouchBlazorApplicationAssemblies @@ -509,14 +512,18 @@ @(_BlazorDependencyInput)" Outputs="$(BlazorResolvedAssembliesOutputPath)" > - - <_DependenciesParameter Include="@(_BlazorDependencyInput->'--reference "%(Identity)"')" /> - + + <_ReferencesArg Condition="'@(_BlazorDependencyInput)' != ''">--references "$(BlazorReferencesConfigFilePath)" <_BclParameter>--base-class-library "$(MonoBaseClassLibraryPath)" --base-class-library "$(MonoBaseClassLibraryFacadesPath)" - + + + @@ -600,16 +607,22 @@ <_LinkerEnabledFlag Condition="'$(_BlazorShouldLinkApplicationAssemblies)' != ''">--linker-enabled + <_ReferencesArg Condition="'@(_AppReferences)' != ''">--references "$(BlazorReferencesConfigFilePath)" <_EmbeddedResourcesArg Condition="'@(_UnlinkedAppReferencesPaths)' != ''">--embedded-resources "$(BlazorEmbeddedResourcesConfigFilePath)" + + - + <_BlazorIndex Include="$(BlazorIndexHtmlOutputPath)" /> @@ -627,4 +640,4 @@ - \ No newline at end of file +