Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(wasm): workaround for invalid net9-browserwasm library detection (backport #18806) #18813

Merged
Merged
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
14 changes: 14 additions & 0 deletions build/nuget/uno.winui.targets
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,18 @@
<Import Project="../uno.winui.runtime-replace.targets" Condition="'$(_UnoIsWinAppSDKDefined)'!='true'" />

<Import Project="../uno.winui.winappsdk.targets" Condition="'$(_UnoIsWinAppSDKDefined)'=='true'" />

<!-- HD workaround for https://github.com/dotnet/sdk/issues/1212, see HD#2924 -->
<Target Name="_RemoveHDAnalyzerRelease"
BeforeTargets="CoreCompile;XamlPreCompile"
Condition=" '$(Optimize)' == 'true' ">
<!---
Remove HD analyzers in release mode, as they cannot work in release mode.
-->
<ItemGroup>
<_HDAnalyzerToRemove Include="@(Analyzer)" Condition="'%(Analyzer.NuGetPackageId)'=='Uno.UI.HotDesign'" />
<Analyzer Remove="@(_HDAnalyzerToRemove)"/>
</ItemGroup>
</Target>

</Project>
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
@(3, "5.3/uno53net9blank/uno53net9blank/uno53net9blank.csproj", @(), @())

# 5.3 lib
@(3, "5.3/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.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.26100"), @()),

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
Loading