If your project simply targets net8.0-windows, it may default to windows7.0 (the minimum supported version in .NET 8.0), causing the mismatch.
Modify MCSecure.csproj to add the full targetframework.
<TargetFramework>net8.0-windows10.1</TargetFramework>