Skip to content

Commit

Permalink
Add workaround for missing blazor.modules.json file
Browse files Browse the repository at this point in the history
  • Loading branch information
mattleibow authored Feb 14, 2025
1 parent 4389ba3 commit 2317b3a
Showing 1 changed file with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,28 @@
</ItemGroup>
</Target>

<!--
Workaround the issue where the empty json file is not included.
Remove for preview 2 as it is fixed in https://github.com/dotnet/aspnetcore/pull/60368
See: https://github.com/dotnet/maui/issues/27806
-->
<Target Name="_Maui_Before_AddBlazorWebViewAssets"
BeforeTargets="_AddBlazorWebViewAssets"
DependsOnTargets="_MauiAddEmptyBlazorModulesJson"
Condition="'$(_MauiSkipAddEmptyBlazorModulesJson)' == 'true'" />
<Target Name="_MauiAddEmptyBlazorModulesJson" Condition="'@(_ExistingBuildJSModules)' == ''">
<PropertyGroup>
<_MauiBlazorWebViewModulesJsonPath>$(IntermediateOutputPath)blazor.modules.json</_MauiBlazorWebViewModulesJsonPath>
</PropertyGroup>
<WriteLinesToFile File="$(_MauiBlazorWebViewModulesJsonPath)" Lines="[]" Overwrite="true" WriteOnlyWhenDifferent="True" />
<ItemGroup>
<FileWrites Include="$(_MauiBlazorWebViewModulesJsonPath)" />
</ItemGroup>
<ItemGroup>
<_WebViewAssetCandidates Include="$(_MauiBlazorWebViewModulesJsonPath)">
<RelativePath>_framework/blazor.modules.json</RelativePath>
</_WebViewAssetCandidates>
</ItemGroup>
</Target>

</Project>

0 comments on commit 2317b3a

Please sign in to comment.