Program Unable to Load DLL 'SQLite.Interop.dll' after WiX Installation

Viewed 976

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 Answers

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>
Related