From d3312b275e3889c7c8bb8facd1b3ab7bb650d237 Mon Sep 17 00:00:00 2001 From: Jerome Laban Date: Fri, 13 Sep 2024 15:55:38 -0400 Subject: [PATCH] feat: Add Microsoft.NET.Sdk.WebAssembly support --- src/Directory.Build.targets | 4 ++-- src/SamplesApp/SamplesApp.Wasm/SamplesApp.Wasm.csproj | 4 ++-- .../Uno.UI.Tasks/Content/uno.ui.tasks.assets.targets | 10 +++++++++- src/Uno.Sdk/Sdk/Sdk.props | 11 +++++++++-- 4 files changed, 22 insertions(+), 7 deletions(-) diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets index 7d77c0a2e11a..9141138f363b 100644 --- a/src/Directory.Build.targets +++ b/src/Directory.Build.targets @@ -75,8 +75,8 @@ - - + + diff --git a/src/SamplesApp/SamplesApp.Wasm/SamplesApp.Wasm.csproj b/src/SamplesApp/SamplesApp.Wasm/SamplesApp.Wasm.csproj index 6cde9d59a42d..d1490ac1a280 100644 --- a/src/SamplesApp/SamplesApp.Wasm/SamplesApp.Wasm.csproj +++ b/src/SamplesApp/SamplesApp.Wasm/SamplesApp.Wasm.csproj @@ -1,5 +1,5 @@ - + $(NetWasmPreviousAndCurrent) @@ -9,7 +9,7 @@ Exe $(DefineConstants);__WASM__;HAS_UNO;UNO_REFERENCE_API - $(NoWarn);NU1701;CS1998;NU1504;UXAML0002 + $(NoWarn);NU1701;CS1998;NU1504;UXAML0002;NU1903;NU1902;IL2026;IL2072;IL2067;IL2075;IL2070;IL2077;IL2057 true true WebAssembly diff --git a/src/SourceGenerators/Uno.UI.Tasks/Content/uno.ui.tasks.assets.targets b/src/SourceGenerators/Uno.UI.Tasks/Content/uno.ui.tasks.assets.targets index c699b59dd06f..88911ee423e9 100644 --- a/src/SourceGenerators/Uno.UI.Tasks/Content/uno.ui.tasks.assets.targets +++ b/src/SourceGenerators/Uno.UI.Tasks/Content/uno.ui.tasks.assets.targets @@ -107,13 +107,21 @@ + + <_UnoAddLibraryAssetsBeforeTargets> + $(_UnoAddLibraryAssetsBeforeTargets); + GetCopyToOutputDirectoryItems; + GenerateUnoWasmAssets; + + + + BeforeTargets="$(_UnoAddLibraryAssetsBeforeTargets)"> diff --git a/src/Uno.Sdk/Sdk/Sdk.props b/src/Uno.Sdk/Sdk/Sdk.props index 6607c72388de..dac3cfdb59ff 100644 --- a/src/Uno.Sdk/Sdk/Sdk.props +++ b/src/Uno.Sdk/Sdk/Sdk.props @@ -14,7 +14,14 @@ Copyright (C) Uno Platform Inc. All rights reserved. <_DefaultMicrosoftNETSdk Condition="$(SingleProject) != 'true' AND $(UnoSingleProject) != 'true' AND ($(MSBuildProjectName.EndsWith('.Wasm')) or $(MSBuildProjectName.EndsWith('.WebAssembly')))">Microsoft.NET.Sdk.Web - <_DefaultMicrosoftNETSdk Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'browserwasm'" >Microsoft.NET.Sdk.Web + <_UnoUseMicrosoftNETSdkWebAssembly Condition=" + $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'browserwasm' + AND $([MSBuild]::GetTargetFrameworkVersion('$(TargetFramework)')) < 9.0 + ">true + + <_DefaultMicrosoftNETSdk Condition=" '$(_UnoUseMicrosoftNETSdkWebAssembly)' == '' ">Microsoft.NET.Sdk.Web + <_DefaultMicrosoftNETSdk Condition=" '$(_UnoUseMicrosoftNETSdkWebAssembly)' == 'true' " >Microsoft.NET.Sdk.WebAssembly + <_DefaultMicrosoftNETSdk Condition=" $(_DefaultMicrosoftNETSdk) == '' ">Microsoft.NET.Sdk <_DefaultWasmOutputType Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'browserwasm'">$(OutputType) @@ -73,7 +80,7 @@ Copyright (C) Uno Platform Inc. All rights reserved. VS to read the global properties and avoid showing a yellow icon being the result of a mismatch between runs of design-time builds (one build defining a FrameworkReference and another one not). --> - +