3
votes

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


1
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
@FlorianKoch - Do you mean \bin\debug\x86 and \bin\debug\x64? - Casper
yeah, exactly like this - Florian Koch
@FlorianKoch - But the problem still exist. - Casper
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

1 Answers

3
votes

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>