Skip to content
Open
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
6 changes: 0 additions & 6 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,6 @@
"commands": [
"xstyler"
]
},
"microsoft.visualstudio.slngen.tool": {
"version": "12.0.32",
"commands": [
"slngen"
]
}
}
}
2 changes: 1 addition & 1 deletion .devcontainer/default.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
}
],
"settings": {
"omnisharp.defaultLaunchSolution": "CommunityToolkit.AllComponents.sln",
"omnisharp.defaultLaunchSolution": "CommunityToolkit.AllComponents.slnx",
"omnisharp.disableMSBuildDiagnosticWarning": true,
"omnisharp.enableRoslynAnalyzers": true,
"omnisharp.useGlobalMono": "never",
Expand Down
56 changes: 26 additions & 30 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ env:
MSBUILD_VERBOSITY: normal
#COREHOST_TRACE: 1
COREHOST_TRACEFILE: corehosttrace.log
MULTI_TARGET_DIRECTORY: tooling/MultiTarget
HEADS_DIRECTORY: tooling/ProjectHeads
IS_MAIN: ${{ github.ref == 'refs/heads/main' }}
IS_PR: ${{ startsWith(github.ref, 'refs/pull/') }}
Expand Down Expand Up @@ -75,7 +74,7 @@ jobs:
- name: Run sample index tests
run: dotnet test tools/SampleIndexExporter.Tests

# Build both Uno.UI/WinUI2/UWP and Uno.WinUI/WinUI3/WindowsAppSDK versions of our packages using a matrix
# Build both the UWP/WinUI2 and the WindowsAppSDK + Uno.WinUI/WinUI3 versions of our packages using a matrix
build:
needs: [Xaml-Style-Check]
runs-on: windows-2025-large
Expand All @@ -87,15 +86,25 @@ jobs:
strategy:
fail-fast: false # prevent one matrix pipeline from being cancelled if one fails, we want them all to run to completion.
matrix:
winui: [2, 3]
multitarget: ['uwp', 'wasdk', 'wasm', 'wpf', 'linuxgtk', 'macos', 'ios', 'android']
exclude:
# WinUI 2 not supported on wasdk
include:
# WinUI 2 is only supported on uwp
- winui: 2
multitarget: uwp
# WinUI 3 is supported on wasdk and all Uno targets
- winui: 3
multitarget: wasdk
# WinUI 3 not supported on uwp
- winui: 3
multitarget: uwp
multitarget: wasm
- winui: 3
multitarget: wpf
- winui: 3
multitarget: linuxgtk
- winui: 3
multitarget: macos
- winui: 3
multitarget: ios
- winui: 3
multitarget: android

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
Expand Down Expand Up @@ -161,12 +170,12 @@ jobs:
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v2
with:
vs-version: '[17.9,)'
vs-version: '[17.13,)'

# Generate full solution with all projects (sample gallery heads, components, tests)
- name: Generate solution with ${{ matrix.multitarget }} gallery, components and tests
working-directory: ./
run: powershell -version 5.1 -command "./tooling/GenerateAllSolution.ps1 -MultiTargets ${{ matrix.multitarget }} ${{ env.ENABLE_DIAGNOSTICS == 'true' && ' -UseDiagnostics' || '' }} -WinUIMajorVersion ${{ matrix.winui }}" -ErrorAction Stop
run: powershell -version 5.1 -command "./tooling/GenerateAllSolution.ps1 -MultiTargets ${{ matrix.multitarget }} ${{ env.ENABLE_DIAGNOSTICS == 'true' && ' -UseDiagnostics' || '' }} -WinUIMajorVersion ${{ matrix.winui }} -Launch 0" -ErrorAction Stop

# Build solution
- name: MSBuild
Expand All @@ -176,7 +185,7 @@ jobs:
/m
${{ env.ENABLE_DIAGNOSTICS == 'true' && '/bl' || '' }}
/v:${{ env.MSBUILD_VERBOSITY }}
CommunityToolkit.AllComponents.sln
CommunityToolkit.AllComponents.slnx

# Run tests
- name: Setup VSTest Path
Expand Down Expand Up @@ -279,6 +288,7 @@ jobs:

# See the matching step in the build job.
- name: Remove .NET SDKs newer than global.json
if: ${{ matrix.winui == '3' }}
shell: pwsh
run: |
$selected = [System.Management.Automation.SemanticVersion](dotnet --version)
Expand All @@ -288,6 +298,7 @@ jobs:
dotnet --list-sdks

- name: Run Uno Check to Install Dependencies
if: ${{ matrix.winui == '3' }}
run: >
dotnet tool run uno-check
--ci
Expand All @@ -302,21 +313,11 @@ jobs:
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v2
with:
vs-version: '[17.9,)'
vs-version: '[17.13,)'

- name: Define excluded MultiTargets (WinUI 2)
if: ${{ matrix.winui == '2' }}
run: |
echo "EXCLUDED_MULTITARGETS=wasdk" >> $env:GITHUB_ENV

- name: Define excluded MultiTargets (WinUI 3)
if: ${{ matrix.winui == '3' }}
run: |
echo "EXCLUDED_MULTITARGETS=uwp" >> $env:GITHUB_ENV

# Build and pack component nupkg
# Build and pack component nupkg (WinUI 2 only builds uwp, WinUI 3 builds wasdk and all Uno targets)
- name: Build and pack component packages
run: ./tooling/Build-Toolkit-Components.ps1 -MultiTargets all -ExcludeMultiTargets ${{ env.EXCLUDED_MULTITARGETS }} -WinUIMajorVersion ${{ matrix.winui }} -DateForVersion ${{ env.VERSION_DATE }} ${{ env.VERSION_PROPERTY != '' && format('-PreviewVersion "{0}"', env.VERSION_PROPERTY) || '' }} ${{ env.ENABLE_DIAGNOSTICS == 'true' && '-EnableBinlogs' || '' }} ${{ env.ENABLE_DIAGNOSTICS == 'true' && '-Verbose' || '' }} -BinlogOutput ./ -NupkgOutput ./ -Release
run: ./tooling/Build-Toolkit-Components.ps1 -MultiTargets all -WinUIMajorVersion ${{ matrix.winui }} -DateForVersion ${{ env.VERSION_DATE }} ${{ env.VERSION_PROPERTY != '' && format('-PreviewVersion "{0}"', env.VERSION_PROPERTY) || '' }} ${{ env.ENABLE_DIAGNOSTICS == 'true' && '-EnableBinlogs' || '' }} ${{ env.ENABLE_DIAGNOSTICS == 'true' && '-Verbose' || '' }} -BinlogOutput ./ -NupkgOutput ./ -Release

# Push Pull Request Packages to our DevOps Artifacts Feed (see nuget.config)
- name: Push Pull Request Packages (if not fork)
Expand Down Expand Up @@ -473,15 +474,10 @@ jobs:
- name: Restore dotnet tools
run: dotnet tool restore

- name: Enable WASM TargetFrameworks
shell: pwsh
working-directory: ./${{ env.MULTI_TARGET_DIRECTORY }}
run: ./UseTargetFrameworks.ps1 wasm

- name: Generate solution
shell: pwsh
working-directory: ./
run: ./tooling/GenerateAllSolution.ps1${{ env.ENABLE_DIAGNOSTICS == 'true' && ' -UseDiagnostics' || '' }}
run: ./tooling/GenerateAllSolution.ps1 -MultiTargets wasm -WinUIMajorVersion 3 -Launch $false${{ env.ENABLE_DIAGNOSTICS == 'true' && ' -UseDiagnostics' || '' }}

- name: Install ninja for WASM native dependencies
run: sudo apt-get install ninja-build
Expand Down
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -356,9 +356,10 @@ MigrationBackup/
.idea/

# Community Toolkit Labs generated files
CommunityToolkit.AllComponents.sln
CommunityToolkit.AllComponents.slnx
tooling/MultiTarget/Generated/**
heads/

# We use slngen to generate solutions
# Solutions are generated by the scripts in the tooling submodule (*.slnx). *.sln covers stale solutions generated by SlnGen.
*.slnx
*.sln
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
"csharp.semanticHighlighting.enabled": true,
"omnisharp.enableMsBuildLoadProjectsOnDemand": true,
"dotnet.completion.showCompletionItemsFromUnimportedNamespaces": true,
"dotnet.defaultSolution": "CommunityToolkit.AllComponents.sln"
"dotnet.defaultSolution": "CommunityToolkit.AllComponents.slnx"
}
2 changes: 1 addition & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{
"label": "generateAllSolution",
"type": "shell",
"command": "pwsh ./tooling/GenerateAllSolution.ps1",
"command": "pwsh -NoProfile -Command \"./tooling/GenerateAllSolution.ps1 -MultiTargets wasm -Launch 0\"",
"group": "build"
}
]
Expand Down
10 changes: 2 additions & 8 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
</ItemGroup>

<PropertyGroup>
<CommonTags>$(CommonTags);UWP;WinUI;Uno;Platform;WindowsAppSDK;WASDK;WinAppSDK;Universal</CommonTags>
<CommonTags>$(CommonTags);UWP;WinUI;Platform;WindowsAppSDK;WASDK;WinAppSDK;Universal</CommonTags>
<CommonTags Condition="'$(PackageIdVariant)' == 'WinUI'">$(CommonTags);Uno</CommonTags>
<PackageTags Condition="'$(PackageTags)' != ''">$(CommonTags);$(PackageTags)</PackageTags>
<PackageTags Condition="'$(PackageTags)' == ''">$(CommonTags)</PackageTags>
</PropertyGroup>
Expand All @@ -15,11 +16,4 @@
<!--<None Include="$(RepositoryDirectory)ThirdPartyNotices.txt" Pack="true" PackagePath="\" />-->
</ItemGroup>

<ItemGroup>
<SlnGenSolutionItem Include="$(MSBuildThisFileDirectory).editorconfig" />
<SlnGenSolutionItem Include="$(MSBuildThisFileDirectory)settings.xamlstyler" />
<SlnGenSolutionItem Include="$(MSBuildThisFileDirectory)*.md" />
<SlnGenSolutionItem Include="$(MSBuildThisFileDirectory)tooling\GlobalUsings*.cs" />
</ItemGroup>

</Project>
6 changes: 4 additions & 2 deletions GenerateAllSolution.bat
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
@ECHO OFF
SET "MultiTargets=%1"
IF "%MultiTargets%"=="" SET "MultiTargets=uwp,wasdk,wasm"
IF "%MultiTargets%"=="" SET "MultiTargets=wasdk,wasm"
SET "WinUIArgs="
IF NOT "%2"=="" SET "WinUIArgs=-WinUIMajorVersion %2"

powershell .\tooling\GenerateAllSolution.ps1 -MultiTargets %MultiTargets%
powershell .\tooling\GenerateAllSolution.ps1 -MultiTargets %MultiTargets% %WinUIArgs%
7 changes: 4 additions & 3 deletions ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ git clone --recurse-submodules https://github.com/CommunityToolkit/Windows.git
```

### 3. Run build scripts & open solution
- Run `dotnet tool restore` from the project root to install SlnGen
- Run `dotnet tool restore` from the project root to install the .NET tools used by the build scripts
- Run `tooling\GenerateAllSolution.ps1` from the project root to generate `CommunityToolkit.AllComponents.slnx` (opening `.slnx` files requires Visual Studio 2022 17.13 or later, or the .NET 9 SDK or later)
- Run build scripts from the [Developer Command Prompt for Visual Studio](https://learn.microsoft.com/visualstudio/ide/reference/command-prompt-powershell) or from elsewhere after adding `MSBuild.exe` to your PATH


Expand All @@ -83,8 +84,8 @@ NuGet is a standard package manager for .NET applications which is built into Vi

There are now two sets of packages for each component:

- `CommunityToolkit.Uwp.*` for UWP + WinUI 2 or Uno.UI
- `CommunityToolkit.WinUI.*` for Windows App SDK + WinUI 3 or Uno.WinUI
- `CommunityToolkit.Uwp.*` for UWP + WinUI 2
- `CommunityToolkit.WinUI.*` for Windows App SDK + WinUI 3 or Uno.WinUI (Uno Platform apps should use these packages)


## 💠 Principles
Expand Down
9 changes: 2 additions & 7 deletions components/Animations/samples/Dependencies.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!--
WinUI 2 under UWP and WinUI 3 under WinAppSdk both use TargetFramework net*-windows10.*
(use the 'IsUwp' and 'IsWinAppSdk' properties below to tell them apart)
However, under Uno-powered platforms, both WinUI 2 and 3 can share the same TargetFramework.
Uno-powered platforms use WinUI 3.

MSBuild doesn't play nicely with this out of the box, so we've made it easy for you.

Expand All @@ -14,18 +14,13 @@
<!-- <PackageReference Include="Microsoft.Toolkit.Uwp.UI.Controls.Primitives" Version="7.1.2"/> -->
</ItemGroup>

<!-- WinUI 2 / Uno -->
<ItemGroup Condition="'$(IsUno)' == 'true' AND '$(WinUIMajorVersion)' == '2'">
<!-- <PackageReference Include="Uno.Microsoft.Toolkit.Uwp.UI.Controls.Primitives" Version="7.1.11"/> -->
</ItemGroup>

<!-- WinUI 3 / WinAppSdk -->
<ItemGroup Condition="'$(IsWinAppSdk)' == 'true'">
<!-- <PackageReference Include="CommunityToolkit.WinUI.UI.Controls.Primitives" Version="7.1.2"/> -->
</ItemGroup>

<!-- WinUI 3 / Uno -->
<ItemGroup Condition="'$(IsUno)' == 'true' AND '$(WinUIMajorVersion)' == '3'">
<ItemGroup Condition="'$(IsUno)' == 'true'">
<!-- <PackageReference Include="Uno.CommunityToolkit.WinUI.UI.Controls.Primitives" Version="7.1.100-dev.15.g12261e2626"/> -->
</ItemGroup>
</Project>
9 changes: 2 additions & 7 deletions components/Animations/src/Dependencies.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!--
WinUI 2 under UWP and WinUI 3 under WinAppSdk both use TargetFramework net*-windows10.*
(use the 'IsUwp' and 'IsWinAppSdk' properties below to tell them apart)
However, under Uno-powered platforms, both WinUI 2 and 3 can share the same TargetFramework.
Uno-powered platforms use WinUI 3.

MSBuild doesn't play nicely with this out of the box, so we've made it easy for you.

Expand All @@ -14,18 +14,13 @@
<!-- <PackageReference Include="Microsoft.Toolkit.Uwp.UI.Controls.Primitives" Version="7.1.2"/> -->
</ItemGroup>

<!-- WinUI 2 / Uno -->
<ItemGroup Condition="'$(IsUno)' == 'true' AND '$(WinUIMajorVersion)' == '2'">
<!-- <PackageReference Include="Uno.Microsoft.Toolkit.Uwp.UI.Controls.Primitives" Version="7.1.11"/> -->
</ItemGroup>

<!-- WinUI 3 / WinAppSdk -->
<ItemGroup Condition="'$(IsWinAppSdk)' == 'true'">
<!-- <PackageReference Include="CommunityToolkit.WinUI.UI.Controls.Primitives" Version="7.1.2"/> -->
</ItemGroup>

<!-- WinUI 3 / Uno -->
<ItemGroup Condition="'$(IsUno)' == 'true' AND '$(WinUIMajorVersion)' == '3'">
<ItemGroup Condition="'$(IsUno)' == 'true'">
<!-- <PackageReference Include="Uno.CommunityToolkit.WinUI.UI.Controls.Primitives" Version="7.1.100-dev.15.g12261e2626"/> -->
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion components/Animations/src/ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ This package contains the following in the `CommunityToolkit.WinUI.Animations` n

## Which Package is for me?

If you're developing with _UWP/WinUI 2 or Uno.UI_ you should be using the `CommunityToolkit.Uwp.Animations` package.
If you're developing with _UWP/WinUI 2_ you should be using the `CommunityToolkit.Uwp.Animations` package.

If you're developing with _WindowsAppSDK/WinUI 3 or Uno.WinUI_ you should be using the `CommunityToolkit.WinUI.Animations` package.

Expand Down
9 changes: 2 additions & 7 deletions components/Behaviors/samples/Dependencies.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!--
WinUI 2 under UWP and WinUI 3 under WinAppSdk both use TargetFramework net*-windows10.*
(use the 'IsUwp' and 'IsWinAppSdk' properties below to tell them apart)
However, under Uno-powered platforms, both WinUI 2 and 3 can share the same TargetFramework.
Uno-powered platforms use WinUI 3.

MSBuild doesn't play nicely with this out of the box, so we've made it easy for you.

Expand All @@ -14,18 +14,13 @@
<!-- <PackageReference Include="Microsoft.Toolkit.Uwp.UI.Controls.Primitives" Version="7.1.2"/> -->
</ItemGroup>

<!-- WinUI 2 / Uno -->
<ItemGroup Condition="'$(IsUno)' == 'true' AND '$(WinUIMajorVersion)' == '2'">
<!-- <PackageReference Include="Uno.Microsoft.Toolkit.Uwp.UI.Controls.Primitives" Version="7.1.11"/> -->
</ItemGroup>

<!-- WinUI 3 / WinAppSdk -->
<ItemGroup Condition="'$(IsWinAppSdk)' == 'true'">
<!-- <PackageReference Include="CommunityToolkit.WinUI.UI.Controls.Primitives" Version="7.1.2"/> -->
</ItemGroup>

<!-- WinUI 3 / Uno -->
<ItemGroup Condition="'$(IsUno)' == 'true' AND '$(WinUIMajorVersion)' == '3'">
<ItemGroup Condition="'$(IsUno)' == 'true'">
<!-- <PackageReference Include="Uno.CommunityToolkit.WinUI.UI.Controls.Primitives" Version="7.1.100-dev.15.g12261e2626"/> -->
</ItemGroup>
</Project>
9 changes: 2 additions & 7 deletions components/Behaviors/src/Dependencies.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!--
WinUI 2 under UWP and WinUI 3 under WinAppSdk both use TargetFramework net*-windows10.*
(use the 'IsUwp' and 'IsWinAppSdk' properties below to tell them apart)
However, under Uno-powered platforms, both WinUI 2 and 3 can share the same TargetFramework.
Uno-powered platforms use WinUI 3.

MSBuild doesn't play nicely with this out of the box, so we've made it easy for you.

Expand All @@ -14,18 +14,13 @@
<PackageReference Include="Microsoft.Xaml.Behaviors.Uwp.Managed" Version="3.0.1"/>
</ItemGroup>

<!-- WinUI 2 / Uno -->
<ItemGroup Condition="'$(IsUno)' == 'true' AND '$(WinUIMajorVersion)' == '2'">
<PackageReference Include="Uno.Microsoft.Xaml.Behaviors.Interactivity" Version="3.0.3" />
</ItemGroup>

<!-- WinUI 3 / WinAppSdk -->
<ItemGroup Condition="'$(IsWinAppSdk)' == 'true'">
<PackageReference Include="Microsoft.Xaml.Behaviors.WinUI.Managed" Version="3.0.1" />
</ItemGroup>

<!-- WinUI 3 / Uno -->
<ItemGroup Condition="'$(IsUno)' == 'true' AND '$(WinUIMajorVersion)' == '3'">
<ItemGroup Condition="'$(IsUno)' == 'true'">
<PackageReference Include="Uno.Microsoft.Xaml.Behaviors.Interactivity.WinUI" Version="3.0.3" />
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions components/Behaviors/src/FocusBehavior.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#if WINDOWS_UWP || HAS_UNO && WINUI2
#if WINDOWS_UWP
using Windows.System;
#elif WINDOWS_WINAPPSDK || HAS_UNO && WINUI3
#elif WINAPPSDK
using Microsoft.UI.Dispatching;
#endif

Expand Down
2 changes: 1 addition & 1 deletion components/Behaviors/src/ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ This package contains the following in the `CommunityToolkit.WinUI.Behaviors` na

## Which Package is for me?

If you're developing with _UWP/WinUI 2 or Uno.UI_ you should be using the `CommunityToolkit.Uwp.Behaviors` package.
If you're developing with _UWP/WinUI 2_ you should be using the `CommunityToolkit.Uwp.Behaviors` package.

If you're developing with _WindowsAppSDK/WinUI 3 or Uno.WinUI_ you should be using the `CommunityToolkit.WinUI.Behaviors` package.

Expand Down
Loading
Loading