(This is a duplicated question which has been asked in stackoverflow.com. I have read the answers. I've tried the solutions, but that didn't solve my problem. I'm going to explain what my problem is and what have I done).
This is my problem:
My application used System.Data.SQLite.DLL. I referenced it and run normally in my computer, but it failed to run on another computer. This is the error message:
System.IO.FileLoadException: Could not load file or assembly 'System.Data.SQLite, Version=1.0.88.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139' or one of its dependencies. The application has failed to start because its side-by-side
configuration is incorrect. Please see the application event log or use the command-line sxstrace.exe tool for more detail.
(Exception from HRESULT: 0x800736B1) File name: 'System.Data.SQLite, Version=1.0.88.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139' ---> System.Runtime.InteropServices.COMException (0x800736B1): The application has failed to start because its side-by-side
configuration is incorrect. Please see the application event log or use the command-line sxstrace.exe tool for more detail.
(Exception from HRESULT: 0x800736B1) at SimPB.config.PrepareDatabase() at SimPB.config.InitializeProgram() at SimPB.Program.Main()
My computer is running Windows 7 32 bit, Visual Studio 2010.
Another computer is running Windows 7 32 bit too, without Visual Studio installed.
What I have tried:
Attempt 1: Make sure the application is build with Release + x86 and the application is build with the target framework: .NET Framework 2.0. Done.
Attempt 2: Make sure the application referenced with the correct build of System.Data.SQLite, which is x86 + .Net Framework 2.0 (sqlite-netFx20-binary-Win32-2005-1.0.88.0). Done
Attempt 3: Try these codes at App.config:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v2.0.50727"/>
</startup>
</configuration>
and this
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v2.0.50727"/>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
<runtime>
<NetFx40_LegacySecurityPolicy enabled="true"/>
</runtime>
</configuration>
and this
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v2.0.50727"/>
</startup>
</configuration>
Done.
Attempt 4: Try turn off User Account Control on the another computer. Done.
Attempt 5: Try install Visual C++ Runtime on the another computer (I install Visual Microsoft Visual C++ Runtime 2010 Redistributable Package (x86), also tried 2005 verson.). Done.
Attempt 6: Try reinstall .NET Framework 2.0 SP2. Receive error:
You must use "Turn Windows Features On or Off" in the Control Panel to install or configure Microsoft .NET Framework 2.0 SP2.
Updated: (After reading answers and comments)
Attempt 7: Make sure System.Data.SQLite.DLL is located at the output bin folder. Done
Attempt 8: Double confirm that the another computer is running 32bit Windows 7. Done
Attempt 9: Change the HintPath declaration in .csproj file:
Change this:
<Reference Include="System.Data.SQLite, Version=1.0.88.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=x86">
<HintPath>E:\Developer Soft\SQLite\sqlite-netFx20-binary-bundle-Win32-2005-1.0.88.0\System.Data.SQLite.dll</HintPath>
</Reference>
To this:
<Reference Include="System.Data.SQLite, Version=1.0.88.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=x86">
<HintPath>..\System.Data.SQLite.dll</HintPath>
</Reference>
Done for Attempt 9.
After the above attempts, the result is still the same. The application can run from my computer normally and failed to run on the another computer.
This is an open source freeware, Simple Phone Book. I have committed and uploaded the latest source code to it's source control server at:
http://simpb.codeplex.com/SourceControl/list/changesets (Changeset Number: fd847ac6c406)