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
94 changes: 94 additions & 0 deletions .github/upgrades/dotnet-upgrade-plan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# .NET 8.0 Upgrade Plan

## Execution Steps

Execute steps below sequentially one by one in the order they are listed.

1. Validate that an .NET 8.0 SDK required for this upgrade is installed on the machine and if not, help to get it installed.
2. Ensure that the SDK version specified in global.json files is compatible with the .NET 8.0 upgrade.
3. Upgrade DiskInfoLib\DiskInfoLibWinRT.vcxproj
4. Upgrade DiskInfoLib.Mock\DiskInfoLib.Mock.csproj
5. Upgrade DiskInfoLib.Test\DiskInfoTest.vcxproj
6. Upgrade DiskInfo\DiskInfo.csproj


## Settings

This section contains settings and data used by execution steps.

### Excluded projects

Table below contains projects that do belong to the dependency graph for selected projects and should not be included in the upgrade.

| Project name | Description |
|:-----------------------------------------------|:---------------------------:|
| (none) | No projects explicitly excluded |

### Aggregate NuGet packages modifications across all projects

NuGet packages used across all selected projects or their dependencies that need version update in projects that reference them.

| Package Name | Current Version | New Version | Description |
|:-------------------------------------|:-------------------:|:-----------------:|:----------------------------------------------|
| CommunityToolkit.WinUI | 7.1.2 | | No supported version for .NET 8 discovered; verify replacement or newer major version |
| CommunityToolkit.WinUI.UI | 7.1.2 | | No supported version for .NET 8 discovered; verify replacement or newer major version |
| CommunityToolkit.WinUI.UI.Controls.Markdown | 7.1.2 | | No supported version for .NET 8 discovered; verify replacement or newer major version |
| Microsoft.WindowsAppSDK | 1.2.230313.1 | 1.8.251003001 | Required Windows App SDK update for .NET 8 compatibility |
| Syncfusion.Chart.WinUI | 20.4.0.54 | | No supported version for .NET 8 discovered; check Syncfusion for WinUI 3/.NET 8 support |
| Syncfusion.Gauge.WinUI | 20.4.0.54 | | No supported version for .NET 8 discovered; check Syncfusion for WinUI 3/.NET 8 support |


### Project upgrade details

#### DiskInfoLib\DiskInfoLibWinRT.vcxproj modifications

Project properties changes:
- Convert the project to an SDK-style project file if possible (ruleId Project.0001).
- Ensure C++ project remains compatible with C++20 settings and C++/WinRT build targets.

NuGet packages changes:
- Review and update any package references imported by this native project (CsWinRT build integration) as needed.

Feature upgrades:
- Migrate any non-SDK MSBuild targets to SDK-style equivalents and update imported targets paths.

Other changes:
- Ensure Generated CsWinRT files and the `CsWinRTIncludes` usage remain valid after conversion.

#### DiskInfoLib.Mock\DiskInfoLib.Mock.csproj modifications

Project properties changes:
- Change Target Framework from `net6.0` to `net8.0` (ruleId Project.0002).

NuGet packages changes:
- Verify compatibility of `MetroLog.Net6` (if referenced) with .NET 8 and replace if needed.

Other changes:
- Rebuild and fix any API/assembly changes introduced by .NET 8.

#### DiskInfoLib.Test\DiskInfoTest.vcxproj modifications

Project properties changes:
- Convert the C++ test project to SDK-style project if possible (ruleId Project.0001).

Other changes:
- Ensure test runner / test adapter used for native tests is compatible with the upgraded toolchain.

#### DiskInfo\DiskInfo.csproj modifications

Project properties changes:
- Change Target Framework from `net6.0-windows10.0.26100.0` to `net8.0-windows10.0.26100.0` (ruleId Project.0002).

NuGet packages changes:
- Update `Microsoft.WindowsAppSDK` from `1.2.230313.1` to `1.8.251003001` as recommended by analysis.
- Review `CommunityToolkit.WinUI`, `CommunityToolkit.WinUI.UI`, and `CommunityToolkit.WinUI.UI.Controls.Markdown` for .NET 8 compatible replacements or later major versions; analysis reported no supported versions found.
- Review `Syncfusion.Chart.WinUI` and `Syncfusion.Gauge.WinUI` for .NET 8-compatible packages or replacements.

Feature upgrades:
- Ensure WinUI and Windows App SDK integration is updated to match the newer package versions and any API changes.

Other changes:
- Re-generate CsWinRT generated files in `obj` folder after project changes.



8 changes: 8 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Project>
<PropertyGroup>
<!-- Ensure TargetPlatformVersion is defined for all projects to avoid numeric comparisons failing in some package targets -->
<TargetPlatformVersion>10.0.22621.0</TargetPlatformVersion>
<!-- Keep a minimum version defined as well -->
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
</PropertyGroup>
</Project>
78 changes: 78 additions & 0 deletions DiskInfo/DiskInfo.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.2.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DiskInfo", "DiskInfo\DiskInfo.csproj", "{1EE73238-20D7-D75D-CE61-3E61D4B9A6F0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DiskInfoLib.Mock", "DiskInfoLib.Mock\DiskInfoLib.Mock.csproj", "{03345709-B571-A000-C55B-1DCF8D94C53B}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DiskInfoLibWinRT", "DiskInfoLib\DiskInfoLibWinRT.vcxproj", "{4F404025-D8EE-45E5-BD66-99E5C0DF86DA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|ARM64 = Debug|ARM64
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|ARM64 = Release|ARM64
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{1EE73238-20D7-D75D-CE61-3E61D4B9A6F0}.Debug|Any CPU.ActiveCfg = Debug|x64
{1EE73238-20D7-D75D-CE61-3E61D4B9A6F0}.Debug|Any CPU.Build.0 = Debug|x64
{1EE73238-20D7-D75D-CE61-3E61D4B9A6F0}.Debug|ARM64.ActiveCfg = Debug|ARM64
{1EE73238-20D7-D75D-CE61-3E61D4B9A6F0}.Debug|ARM64.Build.0 = Debug|ARM64
{1EE73238-20D7-D75D-CE61-3E61D4B9A6F0}.Debug|x64.ActiveCfg = Debug|x64
{1EE73238-20D7-D75D-CE61-3E61D4B9A6F0}.Debug|x64.Build.0 = Debug|x64
{1EE73238-20D7-D75D-CE61-3E61D4B9A6F0}.Debug|x86.ActiveCfg = Debug|x86
{1EE73238-20D7-D75D-CE61-3E61D4B9A6F0}.Debug|x86.Build.0 = Debug|x86
{1EE73238-20D7-D75D-CE61-3E61D4B9A6F0}.Release|Any CPU.ActiveCfg = Release|x64
{1EE73238-20D7-D75D-CE61-3E61D4B9A6F0}.Release|Any CPU.Build.0 = Release|x64
{1EE73238-20D7-D75D-CE61-3E61D4B9A6F0}.Release|ARM64.ActiveCfg = Release|ARM64
{1EE73238-20D7-D75D-CE61-3E61D4B9A6F0}.Release|ARM64.Build.0 = Release|ARM64
{1EE73238-20D7-D75D-CE61-3E61D4B9A6F0}.Release|x64.ActiveCfg = Release|x64
{1EE73238-20D7-D75D-CE61-3E61D4B9A6F0}.Release|x64.Build.0 = Release|x64
{1EE73238-20D7-D75D-CE61-3E61D4B9A6F0}.Release|x86.ActiveCfg = Release|x86
{1EE73238-20D7-D75D-CE61-3E61D4B9A6F0}.Release|x86.Build.0 = Release|x86
{03345709-B571-A000-C55B-1DCF8D94C53B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{03345709-B571-A000-C55B-1DCF8D94C53B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{03345709-B571-A000-C55B-1DCF8D94C53B}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{03345709-B571-A000-C55B-1DCF8D94C53B}.Debug|ARM64.Build.0 = Debug|Any CPU
{03345709-B571-A000-C55B-1DCF8D94C53B}.Debug|x64.ActiveCfg = Debug|Any CPU
{03345709-B571-A000-C55B-1DCF8D94C53B}.Debug|x64.Build.0 = Debug|Any CPU
{03345709-B571-A000-C55B-1DCF8D94C53B}.Debug|x86.ActiveCfg = Debug|Any CPU
{03345709-B571-A000-C55B-1DCF8D94C53B}.Debug|x86.Build.0 = Debug|Any CPU
{03345709-B571-A000-C55B-1DCF8D94C53B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{03345709-B571-A000-C55B-1DCF8D94C53B}.Release|Any CPU.Build.0 = Release|Any CPU
{03345709-B571-A000-C55B-1DCF8D94C53B}.Release|ARM64.ActiveCfg = Release|Any CPU
{03345709-B571-A000-C55B-1DCF8D94C53B}.Release|ARM64.Build.0 = Release|Any CPU
{03345709-B571-A000-C55B-1DCF8D94C53B}.Release|x64.ActiveCfg = Release|Any CPU
{03345709-B571-A000-C55B-1DCF8D94C53B}.Release|x64.Build.0 = Release|Any CPU
{03345709-B571-A000-C55B-1DCF8D94C53B}.Release|x86.ActiveCfg = Release|Any CPU
{03345709-B571-A000-C55B-1DCF8D94C53B}.Release|x86.Build.0 = Release|Any CPU
{4F404025-D8EE-45E5-BD66-99E5C0DF86DA}.Debug|Any CPU.ActiveCfg = Debug|x64
{4F404025-D8EE-45E5-BD66-99E5C0DF86DA}.Debug|Any CPU.Build.0 = Debug|x64
{4F404025-D8EE-45E5-BD66-99E5C0DF86DA}.Debug|ARM64.ActiveCfg = Debug|ARM64
{4F404025-D8EE-45E5-BD66-99E5C0DF86DA}.Debug|ARM64.Build.0 = Debug|ARM64
{4F404025-D8EE-45E5-BD66-99E5C0DF86DA}.Debug|x64.ActiveCfg = Debug|x64
{4F404025-D8EE-45E5-BD66-99E5C0DF86DA}.Debug|x64.Build.0 = Debug|x64
{4F404025-D8EE-45E5-BD66-99E5C0DF86DA}.Debug|x86.ActiveCfg = Debug|Win32
{4F404025-D8EE-45E5-BD66-99E5C0DF86DA}.Debug|x86.Build.0 = Debug|Win32
{4F404025-D8EE-45E5-BD66-99E5C0DF86DA}.Release|Any CPU.ActiveCfg = Release|x64
{4F404025-D8EE-45E5-BD66-99E5C0DF86DA}.Release|Any CPU.Build.0 = Release|x64
{4F404025-D8EE-45E5-BD66-99E5C0DF86DA}.Release|ARM64.ActiveCfg = Release|ARM64
{4F404025-D8EE-45E5-BD66-99E5C0DF86DA}.Release|ARM64.Build.0 = Release|ARM64
{4F404025-D8EE-45E5-BD66-99E5C0DF86DA}.Release|x64.ActiveCfg = Release|x64
{4F404025-D8EE-45E5-BD66-99E5C0DF86DA}.Release|x64.Build.0 = Release|x64
{4F404025-D8EE-45E5-BD66-99E5C0DF86DA}.Release|x86.ActiveCfg = Release|Win32
{4F404025-D8EE-45E5-BD66-99E5C0DF86DA}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {B572D975-A0D6-445A-BD0C-A872E0A391FA}
EndGlobalSection
EndGlobal
8 changes: 4 additions & 4 deletions DiskInfo/DiskInfo/Controls/DiskSmartInfoControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,13 @@
GridLinesVisibility="None" HeadersVisibility="Column"
RowDetailsVisibilityMode="Collapsed" SelectionMode="Single">
<toolkit:DataGrid.Columns>
<toolkit:DataGridTextColumn Header="ID"
<toolkit:DataGridTextColumn x:Uid="/DiskInfoPage/SMART_Header_ID"
Binding="{Binding Id}"/>
<toolkit:DataGridTextColumn Header="属性名称"
<toolkit:DataGridTextColumn x:Uid="/DiskInfoPage/SMART_Header_Name"
Binding="{Binding Name}"/>
<toolkit:DataGridTextColumn Header="临界值"
<toolkit:DataGridTextColumn x:Uid="/DiskInfoPage/SMART_Header_Threshold"
Binding="{Binding Threshold}"/>
<toolkit:DataGridTextColumn Header="原始值"
<toolkit:DataGridTextColumn x:Uid="/DiskInfoPage/SMART_Header_RawValue"
Binding="{Binding RawValue}"/>

</toolkit:DataGrid.Columns>
Expand Down
2 changes: 1 addition & 1 deletion DiskInfo/DiskInfo/Controls/GaugeControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@
PositionFactor="0">
<TextBlock Margin="0,48,0,0" HorizontalTextAlignment="Center">
<Span FontSize="20" FontWeight="Normal">
<Run Text="健康状态" />
<Run x:Uid="/DiskInfoPage/HealthStatus" />
</Span>
<LineBreak />
<Span FontWeight="SemiBold">
Expand Down
9 changes: 6 additions & 3 deletions DiskInfo/DiskInfo/Controls/GaugeControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using Syncfusion.UI.Xaml.Gauges;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using Windows.ApplicationModel.Resources;

// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.
Expand All @@ -14,6 +15,8 @@ namespace DiskInfo.Controls
{
public sealed partial class GaugeControl : UserControl, INotifyPropertyChanged
{
private readonly ResourceLoader _loader = ResourceLoader.GetForViewIndependentUse("DiskInfoPage");

public GaugeControl()
{
this.InitializeComponent();
Expand Down Expand Up @@ -53,11 +56,11 @@ public string Desc
get
{
if (Value < 60)
return "报废";
return _loader.GetString("Status_Scrapped");
else if (Value > 90)
return "正常";
return _loader.GetString("Status_Normal");
else
return "良好";
return _loader.GetString("Status_Good");
}
}

Expand Down
5 changes: 4 additions & 1 deletion DiskInfo/DiskInfo/Converters/ReadableCountConverter.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
using System;
using Windows.ApplicationModel.Resources;

namespace DiskInfo.Converters
{
class ReadableCountConverter : Microsoft.UI.Xaml.Data.IValueConverter
{
private static readonly ResourceLoader _loader = ResourceLoader.GetForViewIndependentUse("DiskInfoPage");

public object Convert(object value, Type targetType, object parameter, string language)
{
return $"{(uint)value} ";
return $"{(uint)value} {_loader.GetString("Unit_Times")}";
}

public object ConvertBack(object value, Type targetType, object parameter, string language)
Expand Down
5 changes: 4 additions & 1 deletion DiskInfo/DiskInfo/Converters/ReadableTimeConverter.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
using System;
using Windows.ApplicationModel.Resources;

namespace DiskInfo.Converters
{
class ReadableTimeConverter : Microsoft.UI.Xaml.Data.IValueConverter
{
private static readonly ResourceLoader _loader = ResourceLoader.GetForViewIndependentUse("DiskInfoPage");

public object Convert(object value, Type targetType, object parameter, string language)
{
return $"{(uint)value} 小时";
return $"{(uint)value} {_loader.GetString("Unit_Hours")}";
}

public object ConvertBack(object value, Type targetType, object parameter, string language)
Expand Down
21 changes: 6 additions & 15 deletions DiskInfo/DiskInfo/DiskInfo.csproj
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<ApplicationManifest>app.manifest</ApplicationManifest>
<BuiltInComInteropSupport>True</BuiltInComInteropSupport>
<CsWinRTIncludes>DiskInfoLibWinRT</CsWinRTIncludes>
<DefaultLanguage>zh-CN</DefaultLanguage>
<DefaultLanguage>en-US</DefaultLanguage>
<OutputType>WinExe</OutputType>
<Platforms>x86;x64;ARM64</Platforms>
<PublishProfile>win10-$(Platform).pubxml</PublishProfile>
<RuntimeIdentifiers>win10-x86;win10-x64;win10-arm64</RuntimeIdentifiers>
<TargetFramework>net6.0-windows10.0.22621.0</TargetFramework>
<RuntimeIdentifiers>win-x86;win-x64;win-arm64</RuntimeIdentifiers>
<TargetFramework>net8.0-windows10.0.26100.0</TargetFramework>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<UseMock>false</UseMock>
<UseWinUI>true</UseWinUI>
</PropertyGroup>

<PropertyGroup>
<EnableMsixTooling>True</EnableMsixTooling>
<CsWinRTGeneratedFilesDir>$(OutDir)</CsWinRTGeneratedFilesDir>
<GenerateAppInstallerFile>False</GenerateAppInstallerFile>
<AppxPackageSigningEnabled>True</AppxPackageSigningEnabled>
<AppxPackageSigningEnabled>False</AppxPackageSigningEnabled>
<PackageCertificateThumbprint>0E886E609DD7C496A3DE178F7DD1DF16B72DD2EF</PackageCertificateThumbprint>
<AppxPackageSigningTimestampDigestAlgorithm>SHA256</AppxPackageSigningTimestampDigestAlgorithm>
<AppxAutoIncrementPackageRevision>False</AppxAutoIncrementPackageRevision>
Expand All @@ -30,21 +28,18 @@
<AppInstallerUri>E:\</AppInstallerUri>
<HoursBetweenUpdateChecks>0</HoursBetweenUpdateChecks>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CommunityToolkit.WinUI" Version="7.1.2" />
<PackageReference Include="CommunityToolkit.WinUI.UI" Version="7.1.2" />
<PackageReference Include="CommunityToolkit.WinUI.UI.Controls.Markdown" Version="7.1.2" />
<PackageReference Include="MetroLog.Net6" Version="2.1.0" />
<PackageReference Include="Microsoft.Windows.CsWin32" Version="0.2.188-beta" PrivateAssets="all" />
<PackageReference Include="Microsoft.Windows.CsWinRT" Version="2.0.1" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.756" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.2.230313.1" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="2.0.0-experimental3" />
<PackageReference Include="Syncfusion.Chart.WinUI" Version="20.4.0.54" />
<PackageReference Include="Syncfusion.Gauge.WinUI" Version="20.4.0.54" />
<Manifest Include="$(ApplicationManifest)" />
</ItemGroup>

<!--
Defining the "Msix" ProjectCapability here allows the Single-project MSIX Packaging
Tools extension to be activated for this project even if the Windows App SDK Nuget
Expand All @@ -53,15 +48,12 @@
<ItemGroup Condition="'$(DisableMsixProjectCapabilityAddedByProject)'!='true' and '$(EnableMsixTooling)'=='true'">
<ProjectCapability Include="Msix" />
</ItemGroup>

<ItemGroup Condition="'$(UseMock)' != 'true'">
<ProjectReference Include="..\DiskInfoLib\DiskInfoLibWinRT.vcxproj" />
</ItemGroup>

<ItemGroup Condition="'$(UseMock)' == 'true'">
<ProjectReference Include="..\DiskInfoLib.Mock\DiskInfoLib.Mock.csproj" />
</ItemGroup>

<!--
Defining the "HasPackageAndPublishMenuAddedByProject" property here allows the Solution
Explorer "Package and Publish" context menu entry to be enabled for this project even if
Expand All @@ -70,5 +62,4 @@
<PropertyGroup Condition="'$(DisableHasPackageAndPublishMenuAddedByProject)'!='true' and '$(EnableMsixTooling)'=='true'">
<HasPackageAndPublishMenu>true</HasPackageAndPublishMenu>
</PropertyGroup>

</Project>
</Project>
2 changes: 1 addition & 1 deletion DiskInfo/DiskInfo/Helpers/LanguageHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace DiskInfo.Helpers
public static class LanguageHelper
{
public const string AutoLanguageCode = "auto";
public const string FallbackLanguageCode = "zh-CN";
public const string FallbackLanguageCode = "en-US";

public static readonly List<string> SupportLanguages = new()
{
Expand Down
Loading