How can i delete my .db file from WPF application? : I have a slight problem that I'm trying to solve. I am using SQLite database and i created my database *Schedule.db* automatically when application starts for the first time(if .db does not already exists). 

On a button_click i want to delete it so i can create new one when i start my application again.

The problem is, every time i try to delete it i get an error: 

**"Additional information: The process cannot access the file '/filePath.../Scheduler.db' because it is being used by another process."**

I understand that i cant delete it because my application is already using it but is there any solution to my current problem?


     string databasePath = AppDomain.CurrentDomain.BaseDirectory + "Scheduler.db";
            
            if (MessageBox.Show("Do you want to delete database: [Scheduler.db]?", "Question", MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.Yes) == MessageBoxResult.Yes)
            {
                if (File.Exists(databasePath))
                { 
                   
                    File.Delete(databasePath);
                    MessageBox.Show("Database deleted: [Scheduler] ");
                    Application.Current.Shutdown();  
                   
                }
                else
                {
                    MessageBox.Show("There is no database: [Scheduler]!");
                }
            }