Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
786 views
in Technique[技术] by (71.8m points)

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

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...inDebugx64SQLite.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


See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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)x86SQLite.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)x64SQLite.Interop.dll" />
        </Component>
    </ComponentGroup>
</Fragment>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...