Skip to content

Commit

Permalink
fix(net9): Allow for builds to happen even if a RID is explicitly set
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromelaban authored Nov 19, 2024
1 parent 7135b26 commit 840a5a7
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
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 @@ -347,6 +347,9 @@ $projects =
# Publishing validation
@(4, "5.3/uno53net9blank/uno53net9blank/uno53net9blank.csproj", @("-f", "net9.0-desktop", "-p:PackageFormat=app"), @("OnlyMacOS", "NetCore", "Publish"))

# Ensure that build can happen even if a RID is specified
@(4, "5.3/uno53net9blank/uno53net9blank/uno53net9blank.csproj", @("-f", "net9.0-android", "-r", "android-arm64"), @("macOS", "NetCore")),

## Note for contributors
##
## When adding new template versions, create them in a separate version named folder
Expand Down
4 changes: 4 additions & 0 deletions src/Uno.Sdk/Sdk/Sdk.targets
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ Copyright (C) Uno Platform Inc. All rights reserved.

<!-- Microsoft.NET.Sdk should be loaded last. This ensures our targets are evaluated before all others. -->
<Import Sdk="$(_DefaultMicrosoftNETSdk)" Project="Sdk.targets" />

<!-- Replacement for restore targets for Wasm when an explicit RID is specified -->
<Import Project="$(_UnoSdkTargetsDirectory)Uno.Wasm.UnsupportedRid.targets"
Condition=" $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'browserwasm' AND '$(RuntimeIdentifier)' != 'browser-wasm' "/>

<!-- Targets and props to be executed last after the default .NET SDK has been imported -->
<Import Project="$(_UnoSdkTargetsDirectory)Uno.Sdk.After.targets" />
Expand Down
17 changes: 17 additions & 0 deletions src/Uno.Sdk/targets/Uno.Wasm.UnsupportedRid.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<!--
This file recreates the targets from NuGet.target that are needed when
building with `-r` to specify a RID. In this case, inclusion conditions in the
WebAssembly SDK do not include any of the nuget targets, causing the restore
to fail. Those targets are intentionally empty to keep the restore going.
-->

<Target Name="_GetRestoreSettingsPerFramework" />

<Target Name="GetAllRuntimeIdentifiers"
Returns="browser-wasm" />

<Target Name="_GenerateProjectRestoreGraphPerFramework" />

</Project>

0 comments on commit 840a5a7

Please sign in to comment.