I am writing a program in WPF, and the problem I am facing is that the code that runs in my program and in the VS constructor loads the SQLite database. If the file does not exist, the code attempts to create an empty database.
Although all this code works fine at runtime. In the designer, the relative path to the database file is different: 'c: \ Program Files (x86) \ Microsoft Visual Studio 10.0 \ Common7 \ IDE. Since the program does not have write access to this folder, an exception is thrown that prevents me from using the constructor.
If I change my program to use the absolute path to the database, and everything works fine. The designer even reads the database and initializes the interface with data from it.
Is it possible to change the working directory that the visual studio designer uses to evaluate the code so that I can continue to use the relative path. Alternatively, some way to get the exe location, not the working directory. All I tried returns the VS IDE folder.
source share