Skip to content
Closed
Show file tree
Hide file tree
Changes from 8 commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>

<!-- NuGet -->
<IsPackable>true</IsPackable>
<IsShipping>true</IsShipping>
<IsShippingPackage>true</IsShippingPackage>
Comment thread
maraf marked this conversation as resolved.
<PackageId>Microsoft.DotNet.HotReload.WebAssembly.Browser</PackageId>
<Description>HotReload package for WebAssembly</Description>
<!-- Remove once https://github.com/NuGet/Home/issues/8583 is fixed -->
Expand Down
42 changes: 39 additions & 3 deletions src/WasmSdk/Sdk/Sdk.targets
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,46 @@ Copyright (c) .NET Foundation. All rights reserved.
<_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="_ImplicitlyReferenceHotReload" BeforeTargets="ResolveProjectStaticWebAssets" AfterTargets="ResolveStaticWebAssetsConfiguration" Condition="'$(_WasmEnableHotReload)' == 'true'">
<PropertyGroup>
<_WasmHotReloadRoot>$([MSBuild]::NormalizeDirectory($(MSBuildThisFileDirectory), '..', 'hotreload'))</_WasmHotReloadRoot>
<_WasmHotReloadDllPath Condition="$([MSBuild]::VersionGreaterThanOrEquals('$(TargetFrameworkVersion)', '10.0'))">net10.0</_WasmHotReloadDllPath>

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@tmat Do you prefer to multi-target the dll or pin it to .NET 10?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Let's pin to .NET 10 until we need runtime features that need higher version. It's simpler and reduces SDK size.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Also, let's target release/10.0.3xx branch instead of main.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I would rather land it on main and backport it to 10. We are testing some scenarios only on main in runtime and I have some unpleasant memories when changes arrived there later due to delayed forward flow in SDK

<_WasmHotReloadDllPath Condition="$([MSBuild]::VersionGreaterThanOrEquals('$(TargetFrameworkVersion)', '11.0'))">net11.0</_WasmHotReloadDllPath>
</PropertyGroup>
<ItemGroup Condition="'$(_WasmHotReloadDllPath)' != ''">
<ReferenceCopyLocalPaths Include="$(_WasmHotReloadRoot)\$(_WasmHotReloadDllPath)\Microsoft.DotNet.HotReload.WebAssembly.Browser.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
</ReferenceCopyLocalPaths>
<_WasmHotReloadModule Include="$(_WasmHotReloadRoot)\wwwroot\Microsoft.DotNet.HotReload.WebAssembly.Browser.lib.module.js">
<TargetPath>_framework\Microsoft.DotNet.HotReload.WebAssembly.Browser.lib.module.js</TargetPath>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
</_WasmHotReloadModule>
<_WasmHotReloadModule OriginalItemSpec="%(Identity)" />
</ItemGroup>

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

<Import Sdk="Microsoft.NET.Sdk.Publish" Project="Sdk.targets" Condition="'$(_WasmSdkImportsMicrosoftNETSdkPublish)' == 'true'" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@
<Pack>true</Pack>
<PackagePath>Sdk</PackagePath>
</AdditionalContent>
<AdditionalContent Include="$(ArtifactsBinDir)\Microsoft.DotNet.HotReload.WebAssembly.Browser\$(Configuration)\**\*.*">
Comment thread
maraf marked this conversation as resolved.
<Pack>true</Pack>
<PackagePath>hotreload</PackagePath>
</AdditionalContent>
<AdditionalContent Include="$(SdkSrcRoot)\BuiltInTools\HotReloadAgent.WebAssembly.Browser\wwwroot\**\*.*">
<Pack>true</Pack>
<PackagePath>hotreload\wwwroot</PackagePath>
</AdditionalContent>
</ItemGroup>

<Target Name="PrepareAdditionalFilesToLayout" BeforeTargets="AssignTargetPaths">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"profiles": {
"http": {
"commandName": "Project",
"dotnetRunMessages": "true",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "http://localhost:5000",
"environmentVariables": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"profiles": {
"http": {
"commandName": "Project",
"dotnetRunMessages": "true",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "http://localhost:5000",
"environmentVariables": {
Expand Down
6 changes: 0 additions & 6 deletions test/UnitTests.proj
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@
<MSBuildSdkResolverDir>$(RepoRoot)artifacts\bin\Microsoft.DotNet.MSBuildSdkResolver</MSBuildSdkResolverDir>
<HelixStage0Targz>$(RepoRoot)artifacts\tmp\HelixStage0.tar.gz</HelixStage0Targz>
<MicrosoftNETBuildExtensions>$(RepoRoot)artifacts\bin\$(Configuration)\Sdks\Microsoft.NET.Build.Extensions</MicrosoftNETBuildExtensions>
<ArtifactsShippingPackages>$(RepoRoot)artifacts\packages\$(Configuration)\Shipping</ArtifactsShippingPackages>
</PropertyGroup>

<TarGzFileCreateFromDirectory
Expand Down Expand Up @@ -183,11 +182,6 @@
<Destination>d/.nuget</Destination>
<Uri>https://netcorenativeassets.blob.core.windows.net/resource-packages/external/any/sdk-test-assets/SDKTestRunPackages2.zip</Uri>
</HelixCorrelationPayload>

<HelixCorrelationPayload Include="$(ArtifactsShippingPackages)">
<PayloadDirectory>$(ArtifactsShippingPackages)</PayloadDirectory>
<Destination>d/.nuget</Destination>
</HelixCorrelationPayload>
</ItemGroup>
</Target>

Expand Down
Loading