You are encountering errors because Microsoft.Maui.Essentials is not currently compatible with .NET 8.0 Razor class libraries.
Microsoft.Maui.Essentials packages
I have an razor class library and want to use Microsoft maui SecureStorage. In visual studio , NuGet interface, when select the latest Microsoft.Maui.Essentials packages, get the following errors:
Severity Code Description Project File Line Suppression State
Error NU1213 The package Microsoft.Maui.Essentials.Ref.android 7.0.101 has a package type DotnetPlatform that is incompatible with this project. BIWebRazorLib D:\MyData\CorePortal\BIWebRazorLib\BIWebRazorLib.csproj 1
Severity Code Description Project File Line Suppression State
Error NU1202 Package Microsoft.Maui.Essentials.Ref.android 7.0.101 is not compatible with net8.0 (.NETCoreApp,Version=v8.0). Package Microsoft.Maui.Essentials.Ref.android 7.0.101 supports: net7.0-android30.0 (.NETCoreApp,Version=v7.0) BIWebRazorLib D:\MyData\CorePortal\BIWebRazorLib\BIWebRazorLib.csproj 1
Severity Code Description Project File Line Suppression State
Error Package 'Microsoft.Maui.Essentials.Ref.android 7.0.101' has a package type 'DotnetPlatform' that is not supported by project 'BIWebRazorLib'.