Skip to content

Commit

Permalink
Switch from .Net6 to .Net8 for Avalonia
Browse files Browse the repository at this point in the history
WPF still uses .Net7 (as two identical target frameworks but with different compile switches is tricky with Visual Studio)
  • Loading branch information
topeterk committed May 5, 2024
1 parent 702b0db commit 173cf0e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Config/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public static Icon GetCustomAppIcon()
{
#if AVALONIA
#if WINDOWS
if (Settings.Default.UseIconFromRootFolder && OperatingSystem.IsWindows())
if (Settings.Default.UseIconFromRootFolder && OperatingSystem.IsWindowsVersionAtLeast(6, 1))
{
if (iconRootFolder is null)
{
Expand Down
10 changes: 7 additions & 3 deletions Helpers/Updater/JsonParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace SystemTrayMenu.Helpers.Updater
// The MIT License (MIT)

// Copyright (c) 2018 Alex Parker
// Copyright (c) 2018-2023 Peter Kirmeier
// Copyright (c) 2018-2024 Peter Kirmeier

// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
Expand Down Expand Up @@ -448,9 +448,13 @@ private static Dictionary<string, T> CreateMemberNameDictionary<T>(T[] members)
return nameToMember;
}

private static object ParseObject(Type type, string json)
private static object? ParseObject(Type type, string json)
{
object instance = FormatterServices.GetUninitializedObject(type);
object? instance = Activator.CreateInstance(type);
if (instance is null)
{
return null;
}

// The list is split into key/value pairs only, this means the split must be divisible by 2 to be valid JSON
List<string> elems = Split(json);
Expand Down
6 changes: 3 additions & 3 deletions SystemTrayMenu.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
<!-- Global project settings -->
<PropertyGroup>
<!-- https://learn.microsoft.com/en-us/dotnet/standard/frameworks -->
<TargetFrameworks>net7.0-windows10.0.22000.0;net6.0-windows10.0.22000.0;net6.0</TargetFrameworks>
<TargetFrameworks>net7.0-windows10.0.22000.0;net8.0-windows10.0.22000.0;net8.0</TargetFrameworks>
<!-- https://docs.microsoft.com/en-us/dotnet/core/rid-catalog -->
<RuntimeIdentifier Condition=" '$(TargetFramework)' == 'net7.0-windows10.0.22000.0' ">win-x64</RuntimeIdentifier> <!-- Windows WPF -->
<RuntimeIdentifier Condition=" '$(TargetFramework)' == 'net6.0-windows10.0.22000.0' ">win-x64</RuntimeIdentifier> <!-- Windows Avalonia -->
<RuntimeIdentifier Condition=" '$(TargetFramework)' == 'net6.0' ">linux-x64</RuntimeIdentifier> <!-- Linux Avalonia -->
<RuntimeIdentifier Condition=" '$(TargetFramework)' == 'net8.0-windows10.0.22000.0' ">win-x64</RuntimeIdentifier> <!-- Windows Avalonia -->
<RuntimeIdentifier Condition=" '$(TargetFramework)' == 'net8.0' ">linux-x64</RuntimeIdentifier> <!-- Linux Avalonia -->
<UseWPF Condition=" '$(TargetFramework)' != 'net7.0-windows10.0.22000.0' ">False</UseWPF>
<UseWPF Condition=" '$(TargetFramework)' == 'net7.0-windows10.0.22000.0' ">True</UseWPF>
<!-- TODO_LINUX/TODO_AVALONIA define marks WPF/Windows code that needs to be ported to Avalonia/Linux -->
Expand Down

0 comments on commit 173cf0e

Please sign in to comment.