Relative path for SQLite not working with WIX Toolset

前端 未结 1 1860
清酒与你
清酒与你 2021-01-23 03:17

I\'m using SQLite Database and create installer of WPF application with WIX Toolset. The problem is, The below relative path works fine when I directly run from Visual Studio bu

相关标签:
1条回答
  • 2021-01-23 03:59

    SQLite.Interop.dll: The file SQLite.Interop.dll needed to be installed along with the rest of the runtime files in order for SQLite to function properly.

    There are two flavors of the file, x86 and x64 format. It is probably advisable to install both files in their respective folders:

    Your installation folder hierarchy - mock-up:

    • YourBinary.exe
    • x86\SQLite.Interop.dll
    • x64\SQLite.Interop.dll
    • System.Data.SQLite.dll
    • Etc...

    Read-Write DB Location: And then your database should be stored in a writeable path (or you need to make the path writeable for regular users using custom ACL permissioning - which is never a great idea).

    Exceptions: Obviously try - catch your database connection, update and access code to detect these kinds of issues.


    1. Folder Confusion: Is there a database file inside the Database folder? It sort of looks like the inventory_control.db file is installed to the main application folder, and not that Database sub-folder?

      • Maybe that file has been generated by the application.exe in the wrong folder?
      • Or maybe you have duplicated the file in the main folder for testing purposes?
    2. Hard-Coded Dev-Box Sins?: What does it say in Inventory Control.exe.config?

      • Are there relevant settings in there that could override your code's values?
      • Could there be a hard-coded dev-box sin in there?
    3. Path Builder: I assume you have "message boxed" the paths from the application during launch, in order to ensure that they are correct? I like to copy the path and do a Start => Run and paste the path to see that it opens. Press CTRL + C when the message box shows. Paste into Notepad. Extract the path and try it in Start => Run.

      • string path = currentPath.Substring(0, currentPath.Length - 21);. It is not very robust to hard code the number of characters in the file name to get the parent directory path?
      • Could you improve it by using Path.GetDirectoryName(currentPath)?
      • Or maybe even: string dir = currentPath.Substring(0,currentPath.LastIndexOf('\\'));
    4. Attach Debugger & Debug Binaries?: Maybe you could install debug binaries and attach to them for debugging as described here: wix c# app doesn't launch after installing. Just to get a real step-through debugging session.

    5. Path Spaces: That database connection string. Does it need quotes around its path? As in "path with spaces"? You may not have any spaces in the paths for your visual Studio project, but when installed there are spaces in the paths.


    This constructs in your source does look weird, why is it necessary?:

    • <?define Inventory Control_TargetDir=$(var.Inventory Control.TargetDir)?>
    0 讨论(0)
提交回复
热议问题