A better fix for the VS publishing hosted projects issue (#274)
This commit is contained in:
parent
4202a6c9e1
commit
03ac95f086
|
|
@ -24,6 +24,13 @@
|
|||
<FileWrites Include="@(BlazorItemOutput->'%(TargetOutputPath)')" />
|
||||
</ItemGroup>
|
||||
</Target>
|
||||
|
||||
<Target Name="_BlazorTrackResolveReferencesDidRun" AfterTargets="ResolveReferences">
|
||||
<PropertyGroup>
|
||||
<!-- So we know we can trust @(ReferenceCopyLocalPaths) later -->
|
||||
<_BlazorResolveReferencesDidRun>true</_BlazorResolveReferencesDidRun>
|
||||
</PropertyGroup>
|
||||
</Target>
|
||||
|
||||
<Target Name="_BlazorBuildReport"
|
||||
AfterTargets="_BlazorCopyFilesToOutputDirectory">
|
||||
|
|
@ -128,6 +135,9 @@
|
|||
for the mono linker.
|
||||
/obj/<<configuration>>/<<targetframework>>/blazor/inputs.basic.cache <- This is the marker file to track the inputs common
|
||||
inputs to the output generation process.
|
||||
/obj/<<configuration>>/<<targetframework>>/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/<<configuration>>/<<targetframework>>/blazor/inputs.linkerswitch.cache <- This is the marker file to track the
|
||||
switch from linking to not linking and viceversa.
|
||||
/obj/<<configuration>>/<<targetframework>>/blazor/inputs.linker.cache <- This is the marker file to track the inputs
|
||||
|
|
@ -187,6 +197,9 @@
|
|||
<!-- /obj/<<configuration>>/<<targetframework>>/blazor/inputs.basic.cache -->
|
||||
<BlazorBuildCommonInputsCache>$(BlazorIntermediateOutputPath)inputs.basic.cache</BlazorBuildCommonInputsCache>
|
||||
|
||||
<!-- /obj/<<configuration>>/<<targetframework>>/blazor/inputs.copylocal.txt -->
|
||||
<BlazorLocalReferencesOutputPath>$(BlazorIntermediateOutputPath)inputs.copylocal.txt</BlazorLocalReferencesOutputPath>
|
||||
|
||||
<!-- /obj/<<configuration>>/<<targetframework>>/blazor/inputs.linkerswitch.cache -->
|
||||
<BlazorBuildLinkerSwitchInputsCache>$(BlazorIntermediateOutputPath)inputs.linkerswitch.cache</BlazorBuildLinkerSwitchInputsCache>
|
||||
|
||||
|
|
@ -231,10 +244,21 @@
|
|||
</Target>
|
||||
|
||||
<Target Name="_DefineBlazorCommonInputs">
|
||||
<!-- If ResolveReferences hasn't yet run, we must be inside a VS publish process
|
||||
that doesn't also do a build, so use the stored information. -->
|
||||
<ReadLinesFromFile
|
||||
Condition="'$(_BlazorResolveReferencesDidRun)'!='true'"
|
||||
File="$(BlazorLocalReferencesOutputPath)">
|
||||
<Output TaskParameter="Lines" ItemName="_BlazorDependencyInput"/>
|
||||
</ReadLinesFromFile>
|
||||
<ItemGroup Condition="'$(_BlazorResolveReferencesDidRun)'=='true'">
|
||||
<!-- ... otherwise we can get the fresh info from @(ReferenceCopyLocalPaths) -->
|
||||
<_BlazorDependencyInput Include="@(ReferenceCopyLocalPaths->WithMetadataValue('Extension','.dll')->'%(FullPath)')" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<_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" />
|
||||
|
||||
<WriteLinesToFile
|
||||
Lines="@(_BlazorDependencyInput)"
|
||||
File="$(BlazorLocalReferencesOutputPath)"
|
||||
Overwrite="True"
|
||||
WriteOnlyWhenDifferent="True" />
|
||||
|
||||
<!-- Switch to detect when we switch from linking to not linking and viceversa -->
|
||||
<WriteLinesToFile
|
||||
|
|
@ -260,6 +290,7 @@
|
|||
<ItemGroup>
|
||||
<FileWrites Include="$(BlazorBuildLinkerSwitchInputsCache)" />
|
||||
<FileWrites Include="$(BlazorBuildCommonInputsCache)" />
|
||||
<FileWrites Include="$(BlazorLocalReferencesOutputPath)" />
|
||||
</ItemGroup>
|
||||
|
||||
</Target>
|
||||
|
|
@ -337,7 +368,7 @@
|
|||
|
||||
<ItemGroup>
|
||||
<_BlazorLinkerInput Include="@(IntermediateAssembly)" />
|
||||
<_BlazorLinkerInput Include="@(ReferenceCopyLocalPaths->WithMetadataValue('Extension','.dll'))" />
|
||||
<_BlazorLinkerInput Include="@(_BlazorDependencyInput)" />
|
||||
<_BlazorLinkerInput Include="@(BlazorLinkerDescriptor)" />
|
||||
<_BlazorLinkerInput Include="$(AdditionalLinkerOptions)" />
|
||||
</ItemGroup>
|
||||
|
|
@ -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.
|
||||
-->
|
||||
<ItemGroup>
|
||||
<_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)"
|
||||
>
|
||||
<ItemGroup>
|
||||
<_DependenciesParameter Include="@(ReferenceCopyLocalPaths->WithMetadataValue('Extension','.dll')->'--reference "%(FullPath)"')" />
|
||||
<_DependenciesParameter Include="@(_BlazorDependencyInput->'--reference "%(Identity)"')" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup>
|
||||
<_BclParameter>--base-class-library "$(MonoBaseClassLibraryPath)" --base-class-library "$(MonoBaseClassLibraryFacadesPath)"</_BclParameter>
|
||||
|
|
@ -564,7 +595,7 @@
|
|||
<_CssReferences Include="@(BlazorPackageCssRef->'_content/%(SourcePackage)/%(RecursiveDir)%(FileName)%(Extension)')" />
|
||||
</ItemGroup>
|
||||
|
||||
<Exec Command="$(BlazorBuildExe) build @(IntermediateAssembly) --html-page "$(BlazorIndexHtml)" @(_AppReferences->'--reference %(Identity)', ' ') @(_JsReferences->'--js %(Identity)', ' ') @(_CssReferences->'--css %(Identity)', ' ') --output "$(BlazorIndexHtmlOutputPath)"" />
|
||||
<Exec Command="$(BlazorBuildExe) build @(IntermediateAssembly) --html-page "$(BlazorIndexHtml)" @(_AppReferences->'--reference "%(Identity)"', ' ') @(_JsReferences->'--js "%(Identity)"', ' ') @(_CssReferences->'--css "%(Identity)"', ' ') --output "$(BlazorIndexHtmlOutputPath)"" />
|
||||
|
||||
<ItemGroup Condition="Exists('$(BlazorIndexHtmlOutputPath)')">
|
||||
<_BlazorIndex Include="$(BlazorIndexHtmlOutputPath)" />
|
||||
|
|
|
|||
|
|
@ -12,7 +12,9 @@
|
|||
<IsWebConfigTransformDisabled>true</IsWebConfigTransformDisabled>
|
||||
</PropertyGroup>
|
||||
|
||||
<Target Name="BlazorGetCopyToPublishDirectoryItems" BeforeTargets="GetCopyToPublishDirectoryItems">
|
||||
<Target Name="BlazorGetCopyToPublishDirectoryItems"
|
||||
BeforeTargets="GetCopyToPublishDirectoryItems"
|
||||
DependsOnTargets="PrepareBlazorOutputs">
|
||||
<ItemGroup>
|
||||
<!-- Don't want to publish the assemblies from the regular 'bin' dir. Instead we publish ones from 'dist'. -->
|
||||
<ResolvedAssembliesToPublish Remove="@(ResolvedAssembliesToPublish)" />
|
||||
|
|
|
|||
Loading…
Reference in New Issue