Skip to content

Commit

Permalink
fix(wasm): workaround for invalid net9-browserwasm library detection
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromelaban authored Nov 15, 2024
1 parent ce498ef commit 9bd0c1d
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 0 deletions.
3 changes: 3 additions & 0 deletions build/test-scripts/run-net7-template-linux.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ $projects =
# 5.3 Blank with net9
@(2, "5.3/uno53net9blank/uno53net9blank/uno53net9blank.csproj", @(), @())

# 5.3 lib
@(2, "5.3/uno53net9blank/uno53net9Lib/uno53net9Lib.csproj", @(), @())

# 5.3 blank publish testing
# Disabled for LXD setup issues
# @(2, "5.3/uno53net9blank/uno53net9blank/uno53net9blank.csproj", @("-f:net9.0-desktop", "-p:SelfContained=true", "-p:PackageFormat=snap"), @("Publish"))
Expand Down
3 changes: 3 additions & 0 deletions build/test-scripts/run-netcore-mobile-template-tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,9 @@ $projects =
@(3, "5.3/uno53net9blank/uno53net9blank/uno53net9blank.csproj", @("-f", "net9.0-desktop"), @("macOS", "NetCore")),
@(3, "5.3/uno53net9blank/uno53net9blank/uno53net9blank.csproj", @("-f", "net9.0-desktop", $sdkFeatures), @("macOS", "NetCore")),

# 5.3 Library
@(3, "5.3/uno53net9Lib/uno53net9Lib/uno53net9Lib.csproj", @(), @("macOS", "NetCore")),

# Default mode for the template is WindowsAppSDKSelfContained=true, which requires specifying a target platform.
@(4, "5.2/uno52AppWithLib/uno52AppWithLib/uno52AppWithLib.csproj", @("-p:Platform=x86" , "-p:TargetFramework=net8.0-windows10.0.19041"), @()),

Expand Down
6 changes: 6 additions & 0 deletions src/SolutionTemplate/5.3/uno53net9Lib/Class1.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace uno52Lib;

public class Class1
{
}

8 changes: 8 additions & 0 deletions src/SolutionTemplate/5.3/uno53net9Lib/global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"sdk": {
"allowPrerelease": true
},
"msbuild-sdks": {
"Uno.Sdk.Private": "5.2.0-dev.2002"
}
}
41 changes: 41 additions & 0 deletions src/SolutionTemplate/5.3/uno53net9Lib/uno53net9Lib.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<Project Sdk="Uno.Sdk.Private">
<PropertyGroup>
<TargetFrameworks>net9.0;net9.0-ios;net9.0-maccatalyst;net9.0-windows10.0.19041;net9.0-browserwasm;net9.0-desktop</TargetFrameworks>

<!-- Disabled for https://github.com/unoplatform/uno.check/issues/241 -->
<TargetFrameworks Condition="!$([MSBuild]::IsOSPlatform('linux'))">$(TargetFrameworks);net9.0-android</TargetFrameworks>

<!-- Disable android on msbuild .NET Framework until android 35 is supported -->
<TargetFrameworks Condition="'$(MSBuildRuntimeType)' == 'Full'">$(TargetFrameworks.Replace('net9.0-android',''))</TargetFrameworks>
<TargetFrameworks Condition="'$(MSBuildRuntimeType)' == 'Full'">$(TargetFrameworks.Replace('net9.0-ios',''))</TargetFrameworks>
<TargetFrameworks Condition="'$(MSBuildRuntimeType)' == 'Full'">$(TargetFrameworks.Replace('net9.0-maccatalyst',''))</TargetFrameworks>

<!-- Ensures the .xr.xml files are generated in a proper layout folder -->
<GenerateLibraryLayout>true</GenerateLibraryLayout>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<UnoSdkDebugging>true</UnoSdkDebugging>
<OutputType>Library</OutputType>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>

<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">
<!--
If you encounter this error message:
error NETSDK1148: A referenced assembly was compiled using a newer version of Microsoft.Windows.SDK.NET.dll.
Please update to a newer .NET SDK in order to reference this assembly.
This means that the two packages below must be aligned with the "build" version number of
the "Microsoft.Windows.SDK.BuildTools" package above, and the "revision" version number
must be the highest found in https://www.nuget.org/packages/Microsoft.Windows.SDK.NET.Ref.
-->
<!-- <FrameworkReference Update="Microsoft.Windows.SDK.NET.Ref" RuntimeFrameworkVersion="10.0.22621.28" />
<FrameworkReference Update="Microsoft.Windows.SDK.NET.Ref" TargetingPackVersion="10.0.22621.28" /> -->
</ItemGroup>
<Target Name="ValidateIsPackable"
AfterTargets="CoreCompile;Build">
<Error Text="Expected IsPackable='false', however it actually equals '$(IsPackable)'."
Condition="$(IsPackable) == 'true'" />
</Target>
</Project>
3 changes: 3 additions & 0 deletions src/Uno.Sdk/targets/Uno.Common.Wasm.targets
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
<!-- Disable assets generation for libraries -->
<StaticWebAssetsEnabled Condition=" $(OutputType) != 'Exe' ">false</StaticWebAssetsEnabled>

<!-- Workaround for https://github.com/dotnet/runtime/pull/109866 -->
<IsBrowserWasmProject Condition=" $(OutputType) != 'Exe' ">false</IsBrowserWasmProject>

<IsMSALSupported>true</IsMSALSupported>

<!-- net9.0 validation of CA1418 is case sensitive -->
Expand Down

0 comments on commit 9bd0c1d

Please sign in to comment.