Skip to content

Commit ec68ac6

Browse files
authored
Merge pull request #235 from CommunityToolkit/uwp-net8-windows
Enable .NET 8 for uwp MultiTarget, upgrade packages
2 parents eccfbc8 + 228d7c5 commit ec68ac6

File tree

52 files changed

+407
-136
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+407
-136
lines changed

.config/dotnet-tools.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"isRoot": true,
44
"tools": {
55
"uno.check": {
6-
"version": "1.20.2",
6+
"version": "1.27.1",
77
"commands": [
88
"uno-check"
99
]

.devcontainer/Dockerfile

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.208.0/containers/dotnet/.devcontainer/base.Dockerfile
2-
3-
# [Choice] .NET version: 6.0, 5.0, 3.1, 6.0-bullseye, 5.0-bullseye, 3.1-bullseye, 6.0-focal, 5.0-focal, 3.1-focal
4-
ARG VARIANT="6.0-bullseye-slim"
5-
FROM mcr.microsoft.com/vscode/devcontainers/dotnet:0-${VARIANT}
1+
# See https://github.com/devcontainers/images/tree/main/src/dotnet for image choices
2+
FROM mcr.microsoft.com/vscode/devcontainers/dotnet:9.0
63

74
# [Choice] Node.js version: none, lts/*, 16, 14, 12, 10
85
ARG NODE_VERSION="none"

.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"args": {
88
// Update 'VARIANT' to pick a .NET Core version: 3.1, 5.0, 6.0
99
// Append -bullseye or -focal to pin to an OS version.
10-
"VARIANT": "8.0",
10+
"VARIANT": "9.0",
1111
// Options
1212
"NODE_VERSION": "lts/*"
1313
}

.github/workflows/build.yml

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ on:
1616
workflow_dispatch:
1717

1818
env:
19-
DOTNET_VERSION: ${{ '8.0.x' }}
20-
DOTNET_INSTALL_DIR: dotnet-install
21-
DOTNET_ROOT: dotnet-install
19+
DOTNET_VERSION: ${{ '9.0.x' }}
2220
ENABLE_DIAGNOSTICS: false
2321
#COREHOST_TRACE: 1
2422
COREHOST_TRACEFILE: corehosttrace.log
@@ -142,6 +140,20 @@ jobs:
142140
# Test job to build a single experiment to ensure our changes work for both our main types of solutions at the moment
143141
new-experiment:
144142
runs-on: windows-latest
143+
144+
strategy:
145+
fail-fast: false # prevent one matrix pipeline from being cancelled if one fails, we want them all to run to completion.
146+
matrix:
147+
winui: [2, 3]
148+
multitarget: ['uwp', 'wasdk', 'wasm']
149+
exclude:
150+
# WinUI 2 not supported on wasdk
151+
- winui: 2
152+
multitarget: wasdk
153+
# WinUI 3 not supported on uwp
154+
- winui: 3
155+
multitarget: uwp
156+
145157
env:
146158
HEADS_DIRECTORY: tooling/ProjectHeads
147159
PROJECT_DIRECTORY: tooling/ProjectTemplate
@@ -202,7 +214,7 @@ jobs:
202214

203215
- name: Add project heads to ${{ env.TEST_PROJECT_NAME }}
204216
working-directory: ./${{ env.TEST_PROJECT_DIRECTORY }}
205-
run: ${{ github.workspace }}/${{ env.HEADS_DIRECTORY }}/GenerateSingleSampleHeads.ps1 -componentPath ${{ github.workspace }}/${{ env.TEST_PROJECT_DIRECTORY }}${{ env.ENABLE_DIAGNOSTICS == 'true' && ' -UseDiagnostics' || '' }}
217+
run: ${{ github.workspace }}/${{ env.HEADS_DIRECTORY }}/GenerateSingleSampleHeads.ps1 -MultiTargets ${{ matrix.multitarget }} -winui ${{ matrix.winui }} -componentPath "${{ github.workspace }}/${{ env.TEST_PROJECT_DIRECTORY }}${{ env.ENABLE_DIAGNOSTICS == 'true' && ' -UseDiagnostics' || '' }}"
206218

207219
- name: MSBuild
208220
working-directory: ./${{ env.TEST_PROJECT_DIRECTORY }}
@@ -217,18 +229,15 @@ jobs:
217229
with:
218230
domain: ${{ github.repository_owner }}
219231

220-
- name: Run tests in the generated experiment against UWP
221-
id: test-uwp
222-
run: vstest.console.exe ./components/${{ env.TEST_PROJECT_NAME }}/**/${{ env.TEST_PROJECT_NAME }}.Tests.UWP.build.appxrecipe /Framework:FrameworkUap10 /logger:"trx;LogFileName=${{ env.TEST_PROJECT_NAME }}UWP.trx"
223-
224-
- name: Run tests in the generated experiment against WinAppSDK
225-
id: test-winappsdk
226-
run: vstest.console.exe ./components/${{ env.TEST_PROJECT_NAME }}/**/${{ env.TEST_PROJECT_NAME }}.Tests.WinAppSdk.build.appxrecipe /Framework:FrameworkUap10 /logger:"trx;LogFileName=${{ env.TEST_PROJECT_NAME }}WinAppSdk.trx"
232+
- name: Run tests in the generated experiment against ${{ matrix.multitarget }}
233+
if: ${{ matrix.multitarget == 'uwp' || matrix.multitarget == 'wasdk' }}
234+
id: test-platform
235+
run: vstest.console.exe ./components/${{ env.TEST_PROJECT_NAME }}/**/${{ env.TEST_PROJECT_NAME }}.Tests.${{ matrix.multitarget }}.build.appxrecipe /Framework:FrameworkUap10 /logger:"trx;LogFileName=${{ env.TEST_PROJECT_NAME }}${{ matrix.multitarget }}.trx" /Blame
227236

228237
- name: Create test reports
229238
run: |
230239
testspace '[New Experiment]./TestResults/*.trx'
231-
if: ${{ always() && (steps.test-uwp.conclusion == 'success' || steps.test-winappsdk.conclusion == 'success') }}
240+
if: ${{ (matrix.multitarget == 'uwp' || matrix.multitarget == 'wasdk') && (steps.test-platform.conclusion == 'success') }}
232241

233242
- name: Artifact - Diagnostic Logs
234243
uses: actions/upload-artifact@v4

.github/workflows/config/Directory.Build.targets

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
<Project>
2+
<ItemGroup>
3+
<!-- Workaround for WebView2 on uap pulling in Microsoft.VCLibs.Desktop when it shouldn't -->
4+
<SDKReference Remove="Microsoft.VCLibs.Desktop, Version=14.0" />
5+
</ItemGroup>
6+
27
<ItemGroup>
38
<SlnGenSolutionItem Include="$(MSBuildThisFileDirectory).editorconfig" />
49
<SlnGenSolutionItem Include="$(MSBuildThisFileDirectory)settings.xamlstyler" />

Build-Toolkit-Components.ps1

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ Param (
6767
[Alias("c")]
6868
[string[]]$Components = @("all"),
6969

70-
[string[]]$ExcludeComponents,
70+
[string[]]$ExcludeComponents = @(),
7171

7272
[string]$DateForVersion = (Get-Date -UFormat %y%m%d),
7373

@@ -104,6 +104,20 @@ if ($null -eq $ExcludeMultiTargets)
104104
$ExcludeMultiTargets = @()
105105
}
106106

107+
# Both uwp and wasdk share a targetframework. Both cannot be enabled at once.
108+
# If both are supplied, remove one based on WinUIMajorVersion.
109+
if ($MultiTargets.Contains('uwp') -and $MultiTargets.Contains('wasdk'))
110+
{
111+
if ($WinUIMajorVersion -eq 2)
112+
{
113+
$ExcludeMultiTargets = $ExcludeMultiTargets + 'wasdk'
114+
}
115+
else
116+
{
117+
$ExcludeMultiTargets = $ExcludeMultiTargets + 'uwp'
118+
}
119+
}
120+
107121
$MultiTargets = $MultiTargets | Where-Object { $_ -notin $ExcludeMultiTargets }
108122

109123
if ($Components -eq @('all')) {
@@ -199,9 +213,14 @@ foreach ($ComponentName in $Components) {
199213
foreach ($componentCsproj in Get-ChildItem -Path "$PSScriptRoot/../components/$ComponentName/$ComponentDir/*.csproj") {
200214
# Get component name from csproj path
201215
$componentPath = Get-Item "$componentCsproj/../../"
216+
$componentName = $($componentPath.BaseName);
217+
218+
if ($componenName -in $ExcludeComponents) {
219+
continue;
220+
}
202221

203222
# Get supported MultiTarget for this component
204-
$supportedMultiTargets = & $PSScriptRoot\MultiTarget\Get-MultiTargets.ps1 -component $($componentPath.BaseName)
223+
$supportedMultiTargets = & $PSScriptRoot\MultiTarget\Get-MultiTargets.ps1 -component $componentName
205224

206225
# Flag to check if any of the requested targets are supported by the component
207226
$isTargetSupported = $false

Build-Toolkit-Gallery.ps1

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,20 @@ if ($null -eq $ExcludeMultiTargets)
8787
$ExcludeMultiTargets = @()
8888
}
8989

90+
# Both uwp and wasdk share a targetframework. Both cannot be enabled at once.
91+
# If both are supplied, remove one based on WinUIMajorVersion.
92+
if ($MultiTargets.Contains('uwp') -and $MultiTargets.Contains('wasdk'))
93+
{
94+
if ($WinUIMajorVersion -eq 2)
95+
{
96+
$ExcludeMultiTargets = $ExcludeMultiTargets + 'wasdk'
97+
}
98+
else
99+
{
100+
$ExcludeMultiTargets = $ExcludeMultiTargets + 'uwp'
101+
}
102+
}
103+
90104
if ($MultiTargets -eq 'all') {
91105
$MultiTargets = @('wasm', 'uwp', 'wasdk', 'wpf', 'linuxgtk', 'macos', 'ios', 'android', 'netstandard')
92106
}

CommunityToolkit.App.Shared/Pages/GettingStartedPage.xaml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
55
xmlns:behaviors="using:CommunityToolkit.App.Shared.Behaviors"
66
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
7-
xmlns:interactions="using:Microsoft.Xaml.Interactions.Core"
87
xmlns:interactivity="using:Microsoft.Xaml.Interactivity"
98
xmlns:local="using:CommunityToolkit.App.Shared"
109
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
@@ -104,9 +103,9 @@
104103
</StackPanel>
105104
</Button.Content>
106105
<interactivity:Interaction.Behaviors>
107-
<interactions:EventTriggerBehavior EventName="Click">
106+
<interactivity:EventTriggerBehavior EventName="Click">
108107
<behaviors:NavigateToUriAction NavigateUri="https://aka.ms/toolkit/docs" />
109-
</interactions:EventTriggerBehavior>
108+
</interactivity:EventTriggerBehavior>
110109
</interactivity:Interaction.Behaviors>
111110
</Button>
112111
<Button win:AutomationProperties.Name="Learn more on GitHub">
@@ -122,9 +121,9 @@
122121
</StackPanel>
123122
</Button.Content>
124123
<interactivity:Interaction.Behaviors>
125-
<interactions:EventTriggerBehavior EventName="Click">
124+
<interactivity:EventTriggerBehavior EventName="Click">
126125
<behaviors:NavigateToUriAction NavigateUri="https://aka.ms/toolkit/windows" />
127-
</interactions:EventTriggerBehavior>
126+
</interactivity:EventTriggerBehavior>
128127
</interactivity:Interaction.Behaviors>
129128
</Button>
130129

@@ -141,9 +140,9 @@
141140
</StackPanel>
142141
</Button.Content>
143142
<interactivity:Interaction.Behaviors>
144-
<interactions:EventTriggerBehavior EventName="Click">
143+
<interactivity:EventTriggerBehavior EventName="Click">
145144
<behaviors:NavigateToUriAction NavigateUri="https://aka.ms/wct/discord" />
146-
</interactions:EventTriggerBehavior>
145+
</interactivity:EventTriggerBehavior>
147146
</interactivity:Interaction.Behaviors>
148147
</Button>
149148
</StackPanel>

CommunityToolkit.App.Shared/Pages/SettingsPage.xaml.cs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,17 @@
44

55
using Windows.ApplicationModel;
66

7-
namespace CommunityToolkit.App.Shared.Pages
7+
namespace CommunityToolkit.App.Shared.Pages;
8+
9+
/// <summary>
10+
/// An empty page that can be used on its own or navigated to within a Frame.
11+
/// </summary>
12+
public sealed partial class SettingsPage : Page
813
{
9-
/// <summary>
10-
/// An empty page that can be used on its own or navigated to within a Frame.
11-
/// </summary>
12-
public sealed partial class SettingsPage : Page
13-
{
14-
public string AppVersion => $"Version {Package.Current.Id.Version.Major}.{Package.Current.Id.Version.Minor}.{Package.Current.Id.Version.Build}";
14+
public string AppVersion => $"Version {Package.Current.Id.Version.Major}.{Package.Current.Id.Version.Minor}.{Package.Current.Id.Version.Build}";
1515

16-
public SettingsPage()
17-
{
18-
this.InitializeComponent();
19-
}
16+
public SettingsPage()
17+
{
18+
this.InitializeComponent();
2019
}
2120
}

CommunityToolkit.App.Shared/Renderers/ToolkitDocumentationRenderer.xaml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
xmlns:behaviors="using:CommunityToolkit.App.Shared.Behaviors"
66
xmlns:converters="using:CommunityToolkit.WinUI.Converters"
77
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
8-
xmlns:interactions="using:Microsoft.Xaml.Interactions.Core"
98
xmlns:interactivity="using:Microsoft.Xaml.Interactivity"
109
xmlns:local="using:CommunityToolkit.App.Shared"
1110
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
@@ -216,9 +215,9 @@
216215
Text="API doc" />
217216
</StackPanel>
218217
<interactivity:Interaction.Behaviors>
219-
<interactions:EventTriggerBehavior EventName="Click">
218+
<interactivity:EventTriggerBehavior EventName="Click">
220219
<behaviors:NavigateToUriAction NavigateUri="{x:Bind renderer:ToolkitDocumentationRenderer.ToGitHubUri('discussions', Metadata.DiscussionId), Mode=OneWay}" />
221-
</interactions:EventTriggerBehavior>
220+
</interactivity:EventTriggerBehavior>
222221
</interactivity:Interaction.Behaviors>
223222
</Button>-->
224223
<Button win:AutomationProperties.Name="Source code">
@@ -230,9 +229,9 @@
230229
<TextBlock Text="Source code" />
231230
</StackPanel>
232231
<interactivity:Interaction.Behaviors>
233-
<interactions:EventTriggerBehavior EventName="Click">
232+
<interactivity:EventTriggerBehavior EventName="Click">
234233
<behaviors:NavigateToUriAction NavigateUri="{x:Bind renderer:ToolkitDocumentationRenderer.ToComponentUri(Metadata.ComponentName), Mode=OneWay}" />
235-
</interactions:EventTriggerBehavior>
234+
</interactivity:EventTriggerBehavior>
236235
</interactivity:Interaction.Behaviors>
237236
</Button>
238237
<muxc:DropDownButton win:AutomationProperties.Name="Package info">

0 commit comments

Comments
 (0)