diff --git a/src/Microsoft.AspNetCore.Blazor.Build/Cli/Commands/BuildIndexHtmlCommand.cs b/src/Microsoft.AspNetCore.Blazor.Build/Cli/Commands/BuildIndexHtmlCommand.cs index 189a359b3..ddbda6d7a 100644 --- a/src/Microsoft.AspNetCore.Blazor.Build/Cli/Commands/BuildIndexHtmlCommand.cs +++ b/src/Microsoft.AspNetCore.Blazor.Build/Cli/Commands/BuildIndexHtmlCommand.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 @@ -18,9 +19,9 @@ public static void Command(CommandLineApplication command) "The path from the _bin folder to a given referenced dll file (typically just the dll name)", CommandOptionType.MultipleValue); - var embeddedResourcesSources = command.Option("--embedded-resources-source", - "The path to an assembly that may contain embedded resources (typically a referenced assembly in its pre-linked state)", - CommandOptionType.MultipleValue); + 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)", + CommandOptionType.SingleValue); var outputPath = command.Option("--output", "Path to the output file", @@ -44,11 +45,15 @@ public static void Command(CommandLineApplication command) try { + var embeddedResourcesSources = embeddedResourcesFile.HasValue() + ? File.ReadAllLines(embeddedResourcesFile.Value()) + : Array.Empty(); + IndexHtmlWriter.UpdateIndex( clientPage.Value(), mainAssemblyPath.Value, references.Values.ToArray(), - embeddedResourcesSources.Values.ToArray(), + embeddedResourcesSources, linkerEnabledFlag.HasValue(), outputPath.Value()); return 0; diff --git a/src/Microsoft.AspNetCore.Blazor.Build/targets/Blazor.MonoRuntime.targets b/src/Microsoft.AspNetCore.Blazor.Build/targets/Blazor.MonoRuntime.targets index aa88f41f0..f428a76e9 100644 --- a/src/Microsoft.AspNetCore.Blazor.Build/targets/Blazor.MonoRuntime.targets +++ b/src/Microsoft.AspNetCore.Blazor.Build/targets/Blazor.MonoRuntime.targets @@ -236,6 +236,9 @@ $(BlazorIntermediateOutputPath)inputs.index.cache + + $(BlazorIntermediateOutputPath)embedded.resources.txt + @@ -597,9 +600,16 @@ <_LinkerEnabledFlag Condition="'$(_BlazorShouldLinkApplicationAssemblies)' != ''">--linker-enabled + <_EmbeddedResourcesArg Condition="'@(_UnlinkedAppReferencesPaths)' != ''">--embedded-resources "$(BlazorEmbeddedResourcesConfigFilePath)" - + + + <_BlazorIndex Include="$(BlazorIndexHtmlOutputPath)" />