diff --git a/src/Microsoft.AspNetCore.Blazor.Build/targets/Blazor.MonoRuntime.targets b/src/Microsoft.AspNetCore.Blazor.Build/targets/Blazor.MonoRuntime.targets
index 7c8b761aa7..93a95d2b53 100644
--- a/src/Microsoft.AspNetCore.Blazor.Build/targets/Blazor.MonoRuntime.targets
+++ b/src/Microsoft.AspNetCore.Blazor.Build/targets/Blazor.MonoRuntime.targets
@@ -24,6 +24,13 @@
+
+
+
+
+ <_BlazorResolveReferencesDidRun>true
+
+
@@ -128,6 +135,9 @@
for the mono linker.
/obj/<>/<>/blazor/inputs.basic.cache <- This is the marker file to track the inputs common
inputs to the output generation process.
+ /obj/<>/<>/blazor/inputs.copylocal.txt <- Paths to all the copy-local referenced assemblies found
+ during the build process (i.e., the @(ReferenceCopyLocalPaths) values). We need this because when publishing, the build doesn't
+ necessarily also run so this is the only way we know which assemblies to include in linking/resolveassemblies.
/obj/<>/<>/blazor/inputs.linkerswitch.cache <- This is the marker file to track the
switch from linking to not linking and viceversa.
/obj/<>/<>/blazor/inputs.linker.cache <- This is the marker file to track the inputs
@@ -187,6 +197,9 @@
$(BlazorIntermediateOutputPath)inputs.basic.cache
+
+ $(BlazorIntermediateOutputPath)inputs.copylocal.txt
+
$(BlazorIntermediateOutputPath)inputs.linkerswitch.cache
@@ -231,10 +244,21 @@
+
+
+
+
+
+
+ <_BlazorDependencyInput Include="@(ReferenceCopyLocalPaths->WithMetadataValue('Extension','.dll')->'%(FullPath)')" />
+
<_BlazorCommonInput Include="@(IntermediateAssembly)" />
- <_BlazorCommonInput Include="@(ReferenceCopyLocalPaths->WithMetadataValue('Extension','.dll'))" />
+ <_BlazorCommonInput Include="@(_BlazorDependencyInput)" />
<_BlazorCommonInput Include="$(_BlazorShouldLinkApplicationAssemblies)" />
<_BlazorLinkingOption Condition="_BlazorShouldLinkApplicationAssemblies == ''" Include="false" />
<_BlazorLinkingOption Condition="_BlazorShouldLinkApplicationAssemblies != ''" Include="true" />
@@ -249,6 +273,12 @@
File="$(BlazorBuildCommonInputsCache)"
Overwrite="True"
WriteOnlyWhenDifferent="True" />
+
+
+
@@ -337,7 +368,7 @@
<_BlazorLinkerInput Include="@(IntermediateAssembly)" />
- <_BlazorLinkerInput Include="@(ReferenceCopyLocalPaths->WithMetadataValue('Extension','.dll'))" />
+ <_BlazorLinkerInput Include="@(_BlazorDependencyInput)" />
<_BlazorLinkerInput Include="@(BlazorLinkerDescriptor)" />
<_BlazorLinkerInput Include="$(AdditionalLinkerOptions)" />
@@ -363,7 +394,7 @@
Condition="$(_BlazorShouldLinkApplicationAssemblies) != ''"
Inputs="$(BlazorBuildLinkerInputsCache);
@(IntermediateAssembly);
- @(ReferenceCopyLocalPaths->WithMetadataValue('Extension','.dll'));
+ @(_BlazorDependencyInput);
@(BlazorLinkerDescriptor)"
Outputs="$(BlazorIntermediateLinkerResultFilePath)"
>
@@ -380,7 +411,7 @@
4) Add the file we just created to the list of file writes, to support incremental builds.
-->
- <_BlazorAssembliesToLink Include="@(ReferenceCopyLocalPaths->WithMetadataValue('Extension','.dll')->'-a "%(FullPath)"')" />
+ <_BlazorAssembliesToLink Include="@(_BlazorDependencyInput->'-a "%(Identity)"')" />
<_BlazorAssembliesToLink Include="@(IntermediateAssembly->'-a "%(FullPath)"')" />
<_BlazorFolderLookupPaths Include="@(MonoBaseClassLibraryFolder->'-d "%(Identity)"')" />
<_BlazorAssemblyDescriptorFiles
@@ -469,11 +500,11 @@
Condition="'$(_BlazorShouldLinkApplicationAssemblies)' == ''"
Inputs="$(BlazorBuildCommonInputsCache);
@(IntermediateAssembly);
- @(ReferenceCopyLocalPaths->WithMetadataValue('Extension','.dll'))"
+ @(_BlazorDependencyInput)"
Outputs="$(BlazorResolvedAssembliesOutputPath)"
>
- <_DependenciesParameter Include="@(ReferenceCopyLocalPaths->WithMetadataValue('Extension','.dll')->'--reference "%(FullPath)"')" />
+ <_DependenciesParameter Include="@(_BlazorDependencyInput->'--reference "%(Identity)"')" />
<_BclParameter>--base-class-library "$(MonoBaseClassLibraryPath)" --base-class-library "$(MonoBaseClassLibraryFacadesPath)"
@@ -564,7 +595,7 @@
<_CssReferences Include="@(BlazorPackageCssRef->'_content/%(SourcePackage)/%(RecursiveDir)%(FileName)%(Extension)')" />
-
+
<_BlazorIndex Include="$(BlazorIndexHtmlOutputPath)" />
diff --git a/src/Microsoft.AspNetCore.Blazor.Build/targets/Publish.targets b/src/Microsoft.AspNetCore.Blazor.Build/targets/Publish.targets
index 70a58d91b0..9d797145b7 100644
--- a/src/Microsoft.AspNetCore.Blazor.Build/targets/Publish.targets
+++ b/src/Microsoft.AspNetCore.Blazor.Build/targets/Publish.targets
@@ -12,7 +12,9 @@
true
-
+