3

I use WiX to bundle a MSI installation file. After the installation, I execute the program but get the following error.

Unable to load DLL 'SQLite.Interop.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

I have tried to add the two references: SQLite.Interop (x86 and x64) into the WiX project. But I get:

The extension '...\SQLite.Interop.dll' could not be loaded because of the following reason: Could not load file or assembly 'file://.../x86/SQLite.Interop.dll' or one of its dependencies. The module was expected to contain an assembly manifest.

Is this error caused by WiX or by my own application?


UPDATE

I tried to add the reference of SQLite.Interop.dll (x64) to the main project but it gives this error.

A reference to 'V:\Users...\bin\Debug\x64\SQLite.Interop.dll' could not be added. Please make sure that the file is accessible, and that it is a valid assembly or COM component.


References


Casper
  • 4,435
  • 10
  • 41
  • 72
  • SQLite DLLs have to be put in the application directory, in subfolders for x86 and x64 - in VS you can add a Post-Build Step to do this or add the DLLs in their folders to the project and enable copying to output directory. Don't really know about WiX, though. – Florian Koch Sep 21 '17 at 09:31
  • @FlorianKoch - Do you mean `\bin\debug\x86` and `\bin\debug\x64`? – Casper Sep 24 '17 at 10:34
  • yeah, exactly like this – Florian Koch Sep 24 '17 at 10:36
  • @FlorianKoch - But the problem still exist. – Casper Sep 25 '17 at 01:20
  • I tried to directly copy the `\bin\debug\x86` and `\bin\debug\x64` to the application directory and the problem solved. This means that WiX do not help me to copy the two files to the correct place. How to instruct WiX to do it for me? – Casper Sep 25 '17 at 09:25
  • that's the part where I can't really help you... Never used WIX – Florian Koch Sep 25 '17 at 09:39

1 Answers1

3

In the Product.wxs file, add these:

<Directory Id="INSTALLFOLDER" Name="MyApp">
    <!-- ... -->
    <Directory Id="x86_dir" Name="x86" />
    <Directory Id="x64_dir" Name="x64" />
</Directory>


And add these:

<Fragment>
    <ComponentGroup Id="x86_files" Directory="x86">
        <Component Id="SQLite_x86.Interop.dll" Guid="{GUID}">
            <File Id="SQLite_x86.Interop.dll" Name="SQLite.Interop.dll" Source="$(var.MyApp_TargetDir)x86\SQLite.Interop.dll" />
        </Component>
    </ComponentGroup>
</Fragment>
<Fragment>
    <ComponentGroup Id="x64_files" Directory="x64">
        <Component Id="SQLite_x64.Interop.dll" Guid="{GUID}">
            <File Id="SQLite_x64.Interop.dll" Name="SQLite.Interop.dll" Source="$(var.MyApp_TargetDir)x64\SQLite.Interop.dll" />
        </Component>
    </ComponentGroup>
</Fragment>
Casper
  • 4,435
  • 10
  • 41
  • 72
  • I am facing a problem that though these files copied to application folder finally but during custom action these files are not there in temprorary folder. Custom action needed interop for some sql lite data mainupulation which it can't able to do as file is not there. I have put a sleep in my custom action code and put files manually then it did work. Any idea what should i do – Kamran Shahid Oct 25 '17 at 09:59