Hello Good people!! I'm deploying a winform application built with vs 2008 0n XP sp3.
I created a database with empty schema which i dropped in the root folder of the project and in properties i choosed Build Action
: Embedded Resources and Copy to Output directory
: Copy always. Now instead of having connectionstring in the app.config connectionString section, i put an entry in appSetting
: key
="database";value
="mydb.db;Version=3".
So to create my connectionString
i used :
SQLiteConnection con = new SQLiteConnection("Data Source=" + Path.Combine(Application.StartupPath, ConfigurationManager.AppSettings["database"]));
Everything works fine and i packaged the app with a setup project.Now after i installed the app the database could not be found and i was obliged to copy the database to the Application Folder
in the setup project for it to work.
what i thought is that db is supposed to be in the app dll because of copy always
.but i can't access it.So what exactly did i do wrong?
i'm suspecting i should have just connected to the root db meaning not using Application.StartupPath
But i'm here asking for the best practices cause what i did is working but still looking like workaround so please can anyone share his experience with me? thanks for reading