Skip to content

Commit

Permalink
feat: Updated to net9
Browse files Browse the repository at this point in the history
  • Loading branch information
HavenDV committed Dec 6, 2024
1 parent 93f3a3b commit 8773b98
Show file tree
Hide file tree
Showing 20 changed files with 69 additions and 54 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: '9.0.x'

- name: Install workloads
run: dotnet workload install maui
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net4.8;net8.0-windows</TargetFrameworks>
<TargetFrameworks>net4.8;net9.0-windows</TargetFrameworks>
<OutputType>Exe</OutputType>
<LangVersion>preview</LangVersion>
<Nullable>enable</Nullable>
Expand Down
7 changes: 5 additions & 2 deletions src/apps/H.NotifyIcon.Apps.Maui/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ public partial class App : Application
public App()
{
InitializeComponent();

MainPage = new AppShell();
}

protected override Window CreateWindow(IActivationState? activationState)
{
return new Window(new AppShell());
}
}
14 changes: 6 additions & 8 deletions src/apps/H.NotifyIcon.Apps.Maui/H.NotifyIcon.Apps.Maui.csproj
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>$(TargetFrameworks);net8.0-maccatalyst</TargetFrameworks> <!-- net8.0-android;net8.0-ios; -->
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net8.0-windows10.0.19041.0</TargetFrameworks>
<TargetFrameworks>$(TargetFrameworks);net9.0-maccatalyst</TargetFrameworks> <!-- net9.0-android;net9.0-ios; -->
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net9.0-windows10.0.19041.0</TargetFrameworks>
<!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
<!-- <TargetFrameworks>$(TargetFrameworks);net8.0-tizen</TargetFrameworks> -->
<!-- <TargetFrameworks>$(TargetFrameworks);net9.0-tizen</TargetFrameworks> -->

<!-- Note for MacCatalyst:
The default runtime is maccatalyst-x64, except in Release config, in which case the default is maccatalyst-x64;maccatalyst-arm64.
Expand All @@ -30,8 +30,8 @@
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
<ApplicationVersion>1</ApplicationVersion>

<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">11.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">13.1</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">12.2</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">15.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
Expand All @@ -58,11 +58,9 @@

<ItemGroup>
<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="$(MauiVersion)" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.0" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.3.2" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.0" />
<PackageReference Include="SkiaSharp.Views.Maui.Controls" Version="2.88.9" />
<PackageReference Include="SkiaSharp.Views.Maui.Controls" Version="3.116.1" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/apps/H.NotifyIcon.Apps.Maui/MainPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public MainPage()
[RelayCommand]
public void ShowHideWindow()
{
var window = Application.Current?.MainPage?.Window;
var window = Application.Current?.Windows[0];
if (window == null)
{
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows10.0.18362.0</TargetFramework>
<TargetFramework>net9.0-windows10.0.18362.0</TargetFramework>
<TargetPlatformMinVersion>10.0.18362.0</TargetPlatformMinVersion>
<Platforms>x86;x64;arm64</Platforms>
<UseWinUI>true</UseWinUI>
Expand All @@ -22,8 +22,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.0" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.5.240627000" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="9.0.0" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.6.241114003" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.0" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.5.240627000" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.3.2" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="9.0.0" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.6.241114003" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFrameworks>net4.6.2;net8.0-windows</TargetFrameworks>
<TargetFrameworks>net4.6.2;net9.0-windows</TargetFrameworks>
<UseWPF>true</UseWPF>
<LangVersion>preview</LangVersion>
<Nullable>enable</Nullable>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFrameworks>net4.6.2;net8.0-windows</TargetFrameworks>
<TargetFrameworks>net4.6.2;net9.0-windows</TargetFrameworks>
<UseWPF>true</UseWPF>
<GenerateResourceUsePreserializedResources>true</GenerateResourceUsePreserializedResources>
<LangVersion>preview</LangVersion>
Expand Down
3 changes: 2 additions & 1 deletion src/apps/TrimmingHelper/TrimmingHelper.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<PublishTrimmed>true</PublishTrimmed>
<!-- <TrimMode>full</TrimMode> -->
<ImplicitUsings>enable</ImplicitUsings>
Expand All @@ -15,6 +15,7 @@

<ItemGroup>
<TrimmerRootAssembly Include="H.NotifyIcon" />
<TrimmerRootAssembly Include="H.GeneratedIcons.System.Drawing" />
</ItemGroup>

<PropertyGroup Label="Publish">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net4.6.2;netstandard2.0;net6.0;net8.0</TargetFrameworks>
<TargetFrameworks>net4.6.2;netstandard2.0;net8.0;net9.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
<Using Remove="System.Net.Http" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="SkiaSharp" Version="2.88.8" />
<PackageReference Include="SkiaSharp" Version="3.116.1" />
</ItemGroup>

<PropertyGroup Label="NuGet">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,7 @@ public static SKBitmap Generate(
{
if (textRectangle == null)
{
var bounds = new SKRect();
_ = foregroundBrush.MeasureText(text, ref bounds);
_ = font.MeasureText(text, out var bounds, foregroundBrush);

graphics.DrawText(
text: text,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net4.6.2;netstandard2.0;net6.0;net8.0</TargetFrameworks>
<TargetFrameworks>net4.6.2;netstandard2.0;net8.0;net9.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup Label="Usings">
<Using Remove="System.Net.Http" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
<PackageReference Include="System.Drawing.Common" Version="9.0.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net7.0'">
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
<PackageReference Include="System.Drawing.Common" Version="9.0.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
<ItemGroup Condition="'$(TargetFramework)' == 'net9.0'">
<PackageReference Include="System.Drawing.Common" Version="9.0.0" />
</ItemGroup>

Expand Down
9 changes: 4 additions & 5 deletions src/libs/H.NotifyIcon.Maui/H.NotifyIcon.Maui.csproj
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net8.0;net8.0-android;net8.0-ios;net8.0-maccatalyst;net8.0-windows10.0.19041.0</TargetFrameworks>
<TargetFrameworks>net9.0;net9.0-android;net9.0-ios;net9.0-maccatalyst;net9.0-windows10.0.19041.0</TargetFrameworks>
<!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
<!-- <TargetFrameworks>$(TargetFrameworks);net8.0-tizen</TargetFrameworks> -->
<UseMaui>true</UseMaui>
<DefineConstants>$(DefineConstants);HAS_PLATFORM_CODE;HAS_MAUI</DefineConstants>
<DefineConstants Condition="'$(TargetFramework)'=='net8.0-windows10.0.19041.0'">$(DefineConstants);HAS_MAUI_WINUI</DefineConstants>
<DefineConstants Condition="'$(TargetFramework)'=='net9.0-windows10.0.19041.0'">$(DefineConstants);HAS_MAUI_WINUI</DefineConstants>
<NoWarn>$(NoWarn);CA1031;CS8002;CS0108;CA1501;CA1513</NoWarn>
<EnableWindowsTargeting>true</EnableWindowsTargeting>

<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">11.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">13.1</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">12.2</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">15.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
Expand Down Expand Up @@ -40,7 +40,6 @@ popups, context menus, and balloon messages. It can be used directly in code or

<ItemGroup>
<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="$(MauiVersion)" />
</ItemGroup>

<ItemGroup>
Expand Down
30 changes: 22 additions & 8 deletions src/libs/H.NotifyIcon.Uno.WinUI/H.NotifyIcon.Uno.WinUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,6 @@
<EnableMsixTooling>true</EnableMsixTooling>
</PropertyGroup>

<ItemGroup Condition=" '$(TargetFramework)' != 'net8.0-windows10.0.19041' ">
<PackageReference Include="Uno.WinUI" Version="5.4.38" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net8.0-windows10.0.19041'">
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.5.240627000" />
</ItemGroup>

<PropertyGroup Label="NuGet">
<Description>This is an implementation of a NotifyIcon (aka system tray icon or taskbar icon) for the Uno.WinUI Skia.Wpf platform.
It does not just rely on the Windows Forms NotifyIcon component,
Expand All @@ -43,4 +35,26 @@ popups, context menus, and balloon messages. It can be used directly in code or
<ProjectReference Include="..\H.NotifyIcon\H.NotifyIcon.csproj" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
<PackageReference Include="Uno.WinUI" Version="5.5.87" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net8.0-android'">
<PackageReference Include="Uno.WinUI" Version="5.5.87" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net8.0-ios'">
<PackageReference Include="Uno.WinUI" Version="5.5.87" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net8.0-maccatalyst'">
<PackageReference Include="Uno.WinUI" Version="5.5.87" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net8.0-windows10.0.19041'">
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.6.241114003" />
<PackageReference Include="System.Collections.Immutable" Version="9.0.0" />
<PackageReference Include="System.Reflection.Metadata" Version="9.0.0" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion src/libs/H.NotifyIcon.Uno/H.NotifyIcon.Uno.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Uno.UI" Version="5.4.38" />
<PackageReference Include="Uno.UI" Version="5.5.87" />
</ItemGroup>

<PropertyGroup Label="NuGet">
Expand Down
6 changes: 4 additions & 2 deletions src/libs/H.NotifyIcon.WinUI/H.NotifyIcon.WinUI.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0-windows10.0.17763.0</TargetFramework>
<TargetFrameworks>net8.0-windows10.0.17763.0;net8.0-windows10.0.17763.0</TargetFrameworks>
<UseWinUI>true</UseWinUI>
<DefineConstants>$(DefineConstants);HAS_WINUI;IS_PACKABLE;HAS_PLATFORM_CODE</DefineConstants>
<NoWarn>$(NoWarn);CS3021;CA1031;CS8002;CA1513;NETSDK1206</NoWarn>
Expand All @@ -11,7 +11,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.5.240627000" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.6.241114003" />
<PackageReference Include="System.Collections.Immutable" Version="9.0.0" />
<PackageReference Include="System.Reflection.Metadata" Version="9.0.0" />
</ItemGroup>

<PropertyGroup Label="NuGet">
Expand Down
2 changes: 1 addition & 1 deletion src/libs/H.NotifyIcon.Wpf/H.NotifyIcon.Wpf.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net4.6.2;net6.0-windows;net8.0-windows</TargetFrameworks>
<TargetFrameworks>net4.6.2;net8.0-windows;net9.0-windows</TargetFrameworks>
<UseWPF>true</UseWPF>
<DefineConstants>$(DefineConstants);HAS_WPF;HAS_PLATFORM_CODE</DefineConstants>
<RootNamespace>Hardcodet.Wpf.TaskbarNotification</RootNamespace>
Expand Down
2 changes: 1 addition & 1 deletion src/libs/H.NotifyIcon/H.NotifyIcon.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net4.6.2;netstandard2.0;net6.0;net8.0</TargetFrameworks>
<TargetFrameworks>net4.6.2;netstandard2.0;net8.0;net9.0</TargetFrameworks>
<NoWarn>$(NoWarn);CA1031;CA1003;CA1502;CS3016;CS8981;CA1513</NoWarn>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net4.8;net8.0-windows</TargetFrameworks>
<TargetFrameworks>net4.8;net9.0-windows</TargetFrameworks>
<EnableWindowsTargeting>true</EnableWindowsTargeting>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.6.3" />
<PackageReference Include="MSTest.TestFramework" Version="3.6.3" />
<PackageReference Include="MSTest" Version="3.6.3" />
<PackageReference Include="FluentAssertions" Version="7.0.0" />
<PackageReference Include="System.Memory" Version="4.6.0" />
</ItemGroup>
Expand Down

0 comments on commit 8773b98

Please sign in to comment.