Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
7ec7aa6
Fix test assets
maraf Jan 19, 2026
415a97b
Remove dependency on Package for running tests
maraf Jan 21, 2026
1d61ff1
Embed HotReload in WasmSDK
maraf Jan 28, 2026
c777ede
Reference embedded HotReload
maraf Jan 28, 2026
366479c
Define SWA for JSInitializer
maraf Jan 28, 2026
43ca45c
Fix content root
maraf Jan 29, 2026
9b27e95
Don't pack the package
maraf Jan 29, 2026
0b699ca
More properties
maraf Jan 29, 2026
a5c04c4
Feedback
maraf Jan 30, 2026
db3697d
Copy JS part through project reference
maraf Jan 30, 2026
724f7f0
Fix
maraf Jan 30, 2026
438b349
ProjectReference with manual asset copy
maraf Jan 30, 2026
d1eb14f
Fix
maraf Jan 30, 2026
b0b6233
Fix
maraf Jan 30, 2026
d7a29f0
Refactor
maraf Jan 30, 2026
c8bb76b
Baselines
maraf Jan 30, 2026
66273f1
Merge branch 'main' into maraf/WasmHotReloadEmbed
maraf Jan 30, 2026
09dcf66
Don't add .nuget as package source
maraf Jan 30, 2026
a16649e
Fix double slash
maraf Jan 30, 2026
4b7aa5e
Fix duplicate HotReload asset when hosting multiple Blazor WASM apps
lewing Feb 3, 2026
b1f15ee
Merge branch 'main' into fix-hotreload-duplicate-assets
lewing Feb 3, 2026
e8ff518
Remove redundant HelixCorrelationPayload entry
lewing Feb 3, 2026
1d4fa10
Update baselines for HotReload AssetMode change and fix merge conflict
lewing Feb 4, 2026
bf7276c
Fix duplicate asset error with smart deduplication
lewing Feb 4, 2026
afd0106
Remove AssetMode=CurrentProject and update baselines
lewing Feb 4, 2026
6dd965c
Fix HotReload duplicate assets by copying to intermediate folder
lewing Feb 4, 2026
01ee552
Fix HotReload duplicate assets by copying to intermediate folder
lewing Feb 4, 2026
5aec5c8
Restore ArtifactsShippingPackages Helix payload for deduplication test
lewing Feb 4, 2026
75d9e18
Address PR review feedback
lewing Feb 5, 2026
8adbe75
Fix ProjectReference to HotReload.WebAssembly.Browser for net472 comp…
lewing Feb 5, 2026
672ee94
Fix SDK layout: restore AdditionalContent glob and pin HotReload to n…
lewing Feb 6, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion build/RunTestsOnHelix.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ REM call dotnet new so the first run message doesn't interfere with the first te
dotnet new --debug:ephemeral-hive

dotnet nuget list source --configfile %TestExecutionDirectory%\nuget.config
dotnet nuget add source %DOTNET_ROOT%\.nuget --configfile %TestExecutionDirectory%\nuget.config
if exist %TestExecutionDirectory%\Testpackages dotnet nuget add source %TestExecutionDirectory%\Testpackages --name testpackages --configfile %TestExecutionDirectory%\nuget.config

dotnet nuget remove source dotnet6-transport --configfile %TestExecutionDirectory%\nuget.config
Expand Down
1 change: 0 additions & 1 deletion build/RunTestsOnHelix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export DOTNET_SDK_TEST_ASSETS_DIRECTORY=$TestExecutionDirectory/TestAssets
dotnet new --debug:ephemeral-hive

dotnet nuget list source --configfile $TestExecutionDirectory/NuGet.config
dotnet nuget add source $DOTNET_ROOT/.nuget --configfile $TestExecutionDirectory/NuGet.config
dotnet nuget add source $TestExecutionDirectory/Testpackages --configfile $TestExecutionDirectory/NuGet.config
#Remove feeds not needed for tests
dotnet nuget remove source dotnet6-transport --configfile $TestExecutionDirectory/NuGet.config
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>$(SdkTargetFramework)</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
<GenerateDependencyFile>false</GenerateDependencyFile>
<LangVersion>preview</LangVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>

<!-- NuGet -->
<IsPackable>true</IsPackable>
<IsShipping>true</IsShipping>
<IsShippingPackage>true</IsShippingPackage>
<PackageId>Microsoft.DotNet.HotReload.WebAssembly.Browser</PackageId>
<Description>HotReload package for WebAssembly</Description>
<!-- Remove once https://github.com/NuGet/Home/issues/8583 is fixed -->
<NoWarn>$(NoWarn);NU5128</NoWarn>
</PropertyGroup>

<Import Project="..\HotReloadAgent\Microsoft.DotNet.HotReload.Agent.projitems" Label="Shared" />
<Import Project="..\HotReloadAgent.Data\Microsoft.DotNet.HotReload.Agent.Data.projitems" Label="Shared" />

<ItemGroup>
<Content Include="wwwroot\**\*.*" CopyToOutputDirectory="PreserveNewest" />
<InternalsVisibleTo Include="DynamicProxyGenAssembly2" Key="$(MoqPublicKey)" />
</ItemGroup>

</Project>
51 changes: 47 additions & 4 deletions src/WasmSdk/Sdk/Sdk.targets
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,58 @@ Copyright (c) .NET Foundation. All rights reserved.
<Import Sdk="Microsoft.NET.Sdk" Project="Sdk.targets" Condition="'$(RuntimeIdentifier)' == 'wasi-wasm' and '$(_WasmSdkImportsMicrosoftNetSdk)' == 'true'" />

<PropertyGroup>
<!-- Implicit HotReload package reference for .NET 10+ if not explicitly turned off -->
<_WasmEnableHotReload>$(WasmEnableHotReload)</_WasmEnableHotReload>
<_WasmEnableHotReload Condition="'$(_WasmEnableHotReload)' == '' and '$(Configuration)' != 'Debug'">false</_WasmEnableHotReload>
<_WasmEnableHotReload Condition="'$(_WasmEnableHotReload)' == '' and '$(TargetFrameworkIdentifier)' == '.NETCoreApp' and $([MSBuild]::VersionGreaterThanOrEquals('$(TargetFrameworkVersion)', '10.0'))">true</_WasmEnableHotReload>
</PropertyGroup>
<Target Name="_ImplicitlyReferenceHotReload" BeforeTargets="ProcessFrameworkReferences">
<ItemGroup Condition="'$(_WasmEnableHotReload)' == 'true'">
<PackageReference Include="Microsoft.DotNet.HotReload.WebAssembly.Browser" Version="$(NETCoreSdkVersion)" IsImplicitlyDefined="true" />
<Target Name="_WasmImplicitlyReferenceHotReload" BeforeTargets="ResolveProjectStaticWebAssets" AfterTargets="ResolveStaticWebAssetsConfiguration" Condition="'$(_WasmEnableHotReload)' == 'true'">
<PropertyGroup>
<_WasmHotReloadTfm Condition="$([MSBuild]::VersionGreaterThanOrEquals('$(TargetFrameworkVersion)', '10.0'))">net10.0</_WasmHotReloadTfm>
<_WasmHotReloadPath Condition="'$(_WasmHotReloadTfm)' != ''">$([MSBuild]::NormalizeDirectory($(MSBuildThisFileDirectory), '..', 'hotreload', $(_WasmHotReloadTfm)))</_WasmHotReloadPath>
<_WasmHotReloadIntermediatePath>$(IntermediateOutputPath)hotreload\</_WasmHotReloadIntermediatePath>
</PropertyGroup>

<!-- Copy the JS module to intermediate folder to avoid duplicate identity when multiple projects reference the same SDK file -->
<Copy
SourceFiles="$(_WasmHotReloadPath)wwwroot\Microsoft.DotNet.HotReload.WebAssembly.Browser.lib.module.js"
DestinationFolder="$(_WasmHotReloadIntermediatePath)"
SkipUnchangedFiles="true"
Condition="'$(_WasmHotReloadPath)' != ''" />

<ItemGroup Condition="'$(_WasmHotReloadPath)' != ''">
<ReferenceCopyLocalPaths Include="$(_WasmHotReloadPath)Microsoft.DotNet.HotReload.WebAssembly.Browser.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
</ReferenceCopyLocalPaths>
<_WasmHotReloadModule Include="$(_WasmHotReloadIntermediatePath)Microsoft.DotNet.HotReload.WebAssembly.Browser.lib.module.js">
<RelativePath>_framework/Microsoft.DotNet.HotReload.WebAssembly.Browser.lib.module.js</RelativePath>
</_WasmHotReloadModule>
<_WasmHotReloadModule OriginalItemSpec="%(Identity)" />
<FileWrites Include="$(_WasmHotReloadIntermediatePath)Microsoft.DotNet.HotReload.WebAssembly.Browser.lib.module.js" />
</ItemGroup>

<DefineStaticWebAssets
CandidateAssets="@(_WasmHotReloadModule)"
FingerprintCandidates="$(StaticWebAssetsFingerprintContent)"
FingerprintPatterns="@(StaticWebAssetFingerprintPattern)"
SourceId="$(PackageId)"
SourceType="Computed"
ContentRoot="$(_WasmHotReloadIntermediatePath)"
BasePath="$(StaticWebAssetBasePath)"
AssetKind="Build"
AssetTraitName="JSModule"
AssetTraitValue="JSLibraryModule"
PropertyOverrides="AssetTraitName;AssetTraitValue"
Condition="'$(_WasmHotReloadPath)' != ''">
<Output TaskParameter="Assets" ItemName="StaticWebAsset" />
<Output TaskParameter="Assets" ItemName="_WasmHotReloadModuleStaticWebAsset" />
</DefineStaticWebAssets>
<DefineStaticWebAssetEndpoints
CandidateAssets="@(_WasmHotReloadModuleStaticWebAsset)"
ContentTypeMappings="@(StaticWebAssetContentTypeMapping)"
Condition="'$(_WasmHotReloadPath)' != ''">
<Output TaskParameter="Endpoints" ItemName="StaticWebAssetEndpoint" />
</DefineStaticWebAssetEndpoints>
</Target>

<Import Sdk="Microsoft.NET.Sdk.Publish" Project="Sdk.targets" Condition="'$(_WasmSdkImportsMicrosoftNETSdkPublish)' == 'true'" />
Expand Down
11 changes: 10 additions & 1 deletion src/WasmSdk/Tasks/Microsoft.NET.Sdk.WebAssembly.Tasks.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project>
<Project>

<PropertyGroup>
<WasmSdkRoot>$(RepoRoot)\src\WasmSdk\</WasmSdkRoot>
Expand Down Expand Up @@ -39,6 +39,11 @@
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\BuiltInTools\HotReloadAgent.WebAssembly.Browser\Microsoft.DotNet.HotReload.WebAssembly.Browser.csproj">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this have <ReferenceOutputAssembly>false</ReferenceOutputAssembly>?

Copy link
Member

@tmat tmat Feb 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'd also want to avoid flowing the current project TFM to the target project like so:

<SkipGetTargetFrameworkProperties>true</SkipGetTargetFrameworkProperties>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
<UndefineProperties>TargetFramework;TargetFrameworks</UndefineProperties>

If you also set

<OutputItemType>AdditionalContent</OutputItemType>
<Pack>true</Pack>
<PackagePath>hotreload</PackagePath>

you should be able to remove <AdditionalContent Include="$(ArtifactsBinDir)\Microsoft.DotNet.HotReload.WebAssembly.Browser\$(Configuration)\**\*.*"> below.

The ProjectReference should create this item.

See https://github.com/dotnet/sdk/blob/main/src/BuiltInTools/Watch/RuntimeDependencies.props#L5 for an example.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The build is failing because of this:

src\WasmSdk\Tasks\Microsoft.NET.Sdk.WebAssembly.Tasks.csproj(0,0): error NU1201: (NETCORE_ENGINEERING_TELEMETRY=Restore) Project Microsoft.DotNet.HotReload.WebAssembly.Browser is not compatible with net472 (.NETFramework,Version=v4.7.2).

<SkipGetTargetFrameworkProperties>true</SkipGetTargetFrameworkProperties>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
<UndefineProperties>TargetFramework;TargetFrameworks</UndefineProperties>
</ProjectReference>
<AdditionalContent Include="$(WasmSdkRoot)targets\**\*.*">
<Pack>true</Pack>
<PackagePath>targets</PackagePath>
Expand All @@ -47,6 +52,10 @@
<Pack>true</Pack>
<PackagePath>Sdk</PackagePath>
</AdditionalContent>
<AdditionalContent Include="$(ArtifactsBinDir)\Microsoft.DotNet.HotReload.WebAssembly.Browser\$(Configuration)\**\*.*">
<Pack>true</Pack>
<PackagePath>hotreload</PackagePath>
</AdditionalContent>
</ItemGroup>

<Target Name="PrepareAdditionalFilesToLayout" BeforeTargets="AssignTargetPaths">
Expand Down
Loading