Linking SQLite Database with .NET MAUI app

742 views Asked by At

I made a .NET MAUI app that uses a SQLite Database by using System.Data.SQLite and creating a new SQLiteDataAdapter the program was working perfectly for Windows but when I tried to publish it for android using dotnet cli it me and error saying PE image does not have metadata

so I created a new .NET MAUI project and I did not edit anything in it ,and I published it to check if there was any error in the cli on my device but it worked perfectly , then all I did is just adding the NuGet package System.Data.SQLite and then I tried to publish it again and it gave me the same error here is the error details :

C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\33.0.68\targets\Microsoft.Android.Sdk.AssemblyResolution.targets(107,5): error XAPRAS7009: System.InvalidOperationException: PE image does not have metadata
data\testforpeimagedoesnothavemetadata\testforpeimagedoesnothavemetadata.csproj::TargetFramework=net7.0-android]
C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\33.0.68\targets\Microsoft.Android.Sdk.AssemblyResolution.targets(107,5): error XAPRAS7009:    at System.Reflection.PortableExecutable.PEReader.GetMetadataBl
ock() [C:\maui\testforpeimagedoesnothavemetadata\testforpeimagedoesnothavemetadata\testforpeimagedoesnothavemetadata.csproj::TargetFramework=net7.0-android]
C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\33.0.68\targets\Microsoft.Android.Sdk.AssemblyResolution.targets(107,5): error XAPRAS7009:    at System.Reflection.Metadata.PEReaderExtensions.GetMetadataRe
ader(PEReader peReader, MetadataReaderOptions options, MetadataStringDecoder utf8Decoder) [C:\maui\testforpeimagedoesnothavemetadata\testforpeimagedoesnothavemetadata\testforpeimagedoesnothavemetadata.csproj::TargetF
ramework=net7.0-android]
C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\33.0.68\targets\Microsoft.Android.Sdk.AssemblyResolution.targets(107,5): error XAPRAS7009:    at Xamarin.Android.Tasks.ProcessAssemblies.DeduplicateAssembli
es(List`1 output, Dictionary`2 symbols) [C:\maui\testforpeimagedoesnothavemetadata\testforpeimagedoesnothavemetadata\testforpeimagedoesnothavemetadata.csproj::TargetFramework=net7.0-android]
C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\33.0.68\targets\Microsoft.Android.Sdk.AssemblyResolution.targets(107,5): error XAPRAS7009:    at Xamarin.Android.Tasks.ProcessAssemblies.RunTask() [C:\maui\
testforpeimagedoesnothavemetadata\testforpeimagedoesnothavemetadata\testforpeimagedoesnothavemetadata.csproj::TargetFramework=net7.0-android]
C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\33.0.68\targets\Microsoft.Android.Sdk.AssemblyResolution.targets(107,5): error XAPRAS7009:    at Microsoft.Android.Build.Tasks.AndroidTask.Execute() in /Use
rs/runner/work/1/s/xamarin-android/external/xamarin-android-tools/src/Microsoft.Android.Build.BaseTasks/AndroidTask.cs:line 22 [C:\maui\testforpeimagedoesnothavemetadata\testforpeimagedoesnothavemetadata\testforpeima
gedoesnothavemetadata.csproj::TargetFramework=net7.0-android]

And here is the command I executed:

dotnet publish -f net7.0-android -c Release -p:AndroidKeyStore=true 
-p:AndroidSigningKeyStore={keyStoreFilePath}
-p:AndroidSigningKeyAlias={keyStoreAlias} -p:AndroidSigningKeyPass={keystorePassword}
-p:AndroidSigningStorePass={keystorePassword}

is there any way I can link SQLite database to C# using SQLiteDataAdapter that works with .NET MAUI

0

There are 0 answers