Locate Sqllite Database on Windows App

Anonymous
2024-01-04T11:09:58.1333333+00:00

I deployed MAUI App to Windows 10 where could I find The MCQ.db3

I searched in deployment folder

C:\Users\allam\destination\

  public const string DatabaseFilename = "MCQ.db3";
        async Task Init()
        {  
        string dbPath  =
         Path.Combine(FileSystem.AppDataDirectory, DatabaseFilename);
          FileStream fileStream = new FileStream(dbPath, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite);

            _dbConnection = new SQLiteAsyncConnection(dbPath);
            if (Database is not null)
                return;
            Database = new SQLiteAsyncConnection(dbPath, Constants.Flags);
    
            var result = await Database.CreateTableAsync<InQuestion>();
        }
.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
4,008 questions
{count} votes

Accepted answer
  1. Wenyan Zhang (Shanghai Wicresoft Co,.Ltd.) 36,161 Reputation points Microsoft External Staff
    2024-01-05T06:30:46.6266667+00:00

    Hello,

    I deployed MAUI App to Windows 10 where could I find The MCQ.db3

    If you debug the project, please print the path, then go to the path through File Explorer. It's in \Users \ [User]\AppData\Local\Packages\ [Package Name]\LocalState folder.

    Debug.WriteLine(dbPath);
    

    I searched in deployment folder

    It means that you publish the app and install it via MSIX, right?

    An MSIX packaged desktop app writes files to its own virtual registry and application data folder. Please see AppData operations on Windows 10, version 1903 and later

    You could also display the path and go to the path directedly. Or save the package name and go to the user's AppData folder.

    Best Regards,

    Wenyan Zhang


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.