Skip to content

Commit

Permalink
Merge pull request #18310 from unoplatform/mergify/bp/release/stable/…
Browse files Browse the repository at this point in the history
…5.4/pr-18300

fix: Ensure wwwroot assets are copied properly (backport #18300)
  • Loading branch information
jeromelaban authored Sep 30, 2024
2 parents 3fa3eae + ff2629a commit 97901cb
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@
<_AssetsToValidate Include="$(WasmShellOutputPackagePath)\Assets\Icons\icon_foreground.scale-300.png" />
<_AssetsToValidate Include="$(WasmShellOutputPackagePath)\Assets\Icons\icon_foreground.scale-400.png" />

<!-- wwwroot -->
<_AssetsToValidate Include="$(WasmShellOutputPackagePath)\..\staticwebapp.config.json" />
<_AssetsToValidate Include="$(WasmShellOutputPackagePath)\..\web.config" />

<!-- Validate json files handling -->
<_AssetsToValidate Include="$(WasmShellOutputPackagePath)\test_root_asset.json" />
<_AssetsToValidate Include="$(WasmShellOutputPackagePath)\test_root_asset_not_included.json" MustNotExist="true" />
Expand Down
24 changes: 22 additions & 2 deletions src/Uno.Sdk/targets/Uno.Common.Wasm.targets
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
See https://github.com/dotnet/sdk/blob/e3c62139dd25af2b7593a2cde702261f20822e47/src/StaticWebAssetsSdk/Sdk/Sdk.StaticWebAssets.StaticAssets.ProjectSystem.props#L36
-->

<!-- Get all files included by the Web Sdk, except ones from the Assets folder -->
<_ContentToUpdate
Include="@(Content)"
Expand All @@ -61,13 +61,33 @@
<!-- Remove the files Web SDK included files. This will also remove duplicates, regardless of the metadata -->
<Content Remove="@(_ContentToUpdate)"
Condition="'%(_ContentToUpdate.IsWebSdk)'=='true' AND '%(_ContentToUpdate.IsDefaultItem)'!='true'" />

<!-- Add back the non-websdk content -->
<Content Include="@(_NonWebSdkContent)" KeepDuplicates="false" />

<!-- Cleanup -->
<_ContentToUpdate Remove="@(_ContentToUpdate)"/>
<_NonWebSdkContent Remove="@(_NonWebSdkContent)"/>

</ItemGroup>
</Target>

<Target Name="_UnoAdjustWwwrootContent"
BeforeTargets="AssignTargetPaths">

<ItemGroup>
<_wwwRootContentToUpdate Include="$(MSBuildProjectDirectory)/$(WasmProjectFolder)/wwwroot/**" />

<Content Remove="@(_wwwRootContentToUpdate)" />

<Content Include="@(_wwwRootContentToUpdate)">
<Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
<UnoDeploy>Root</UnoDeploy>
<!-- net9+ compatibility -->
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>

<_wwwRootContentToUpdate Remove="@(_wwwRootContentToUpdate)" />
</ItemGroup>
</Target>

Expand Down

0 comments on commit 97901cb

Please sign in to comment.