Skip to content

Commit fd7c50b

Browse files
authored
Fix MAUI static asset updates (#47431)
1 parent b3c447e commit fd7c50b

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/BuiltInTools/dotnet-watch/DotNetWatch.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ Returns: @(Watch)
7070
<!-- In RazorSDK (Blazor, RCL, and Web) targeting apps also watch content files under wwwroot -->
7171
<Watch Include="%(Content.FullPath)"
7272
Condition="'$(UsingMicrosoftNETSdkRazor)'=='true' AND '$(DotNetWatchContentFiles)'!='false' AND '%(Content.Watch)' != 'false' AND $([System.String]::Copy('%(Identity)').Replace('\','/').StartsWith('wwwroot/'))"
73-
StaticWebAssetPath="$(_DotNetWatchStaticWebAssetBasePath)$([System.String]::Copy('%(Identity)').Replace('\','/').Substring(8))" />
73+
StaticWebAssetPath="$(_DotNetWatchStaticWebAssetBasePath)$([System.String]::Copy('%(Identity)').Replace('\','/'))" />
7474

7575
<_WatchProjects Include="%(ProjectReference.Identity)" Condition="'%(ProjectReference.Watch)' != 'false' and Exists('%(Identity)')" />
7676
</ItemGroup>

test/dotnet-watch.Tests/HotReload/ApplyDeltaTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,8 @@ public async Task Razor_Component_ScopedCssAndStaticAssets()
441441

442442
await App.AssertOutputLineStartsWith("dotnet watch 🔥 Hot reload change handled");
443443

444-
App.AssertOutputContains($"dotnet watch ⌚ Sending static asset update request to browser: 'app.css'.");
444+
// "wwwroot" directory is required for MAUI. Web sites work with or without it.
445+
App.AssertOutputContains($"dotnet watch ⌚ Sending static asset update request to browser: 'wwwroot/app.css'.");
445446
App.AssertOutputContains($"dotnet watch 🔥 Hot reload of static files succeeded.");
446447
App.AssertOutputContains(MessageDescriptor.NoCSharpChangesToApply);
447448
App.Process.ClearOutput();

0 commit comments

Comments
 (0)