Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
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>
43 changes: 39 additions & 4 deletions src/WasmSdk/Sdk/Sdk.targets
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,50 @@ 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>
</PropertyGroup>
<ItemGroup Condition="'$(_WasmHotReloadPath)' != ''">
<ReferenceCopyLocalPaths Include="$(_WasmHotReloadPath)Microsoft.DotNet.HotReload.WebAssembly.Browser.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
</ReferenceCopyLocalPaths>
<_WasmHotReloadModule Include="$(_WasmHotReloadPath)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="$(_WasmHotReloadPath)\wwwroot\"
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
16 changes: 10 additions & 6 deletions 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 @@ -35,18 +35,22 @@
</PropertyGroup>

<PropertyGroup>
<TargetFrameworks>$(SdkTargetFramework);net472</TargetFrameworks>
<!-- We are not using the assembly anywhere -->
<TargetFrameworks>$(SdkTargetFramework)</TargetFrameworks>
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this be TargetFramework (singular)?

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm. For some reason it doesn't produce a correct layout - the output SDK folder contains just the dll

</PropertyGroup>

<ItemGroup>
<AdditionalContent Include="$(WasmSdkRoot)targets\**\*.*">
<Pack>true</Pack>
<PackagePath>targets</PackagePath>
</AdditionalContent>
<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.

I think setting metadata of the ProjectReference like so and removing the <AdditionalContent> below would work

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

Copy link
Member Author

Choose a reason for hiding this comment

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

It add items to the AdditionalContent, but the PackagePath metadata is ignored
image

<Private>false</Private>
</ProjectReference>
<AdditionalContent Include="$(WasmSdkRoot)Sdk\**\*.*">
<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
Loading