Hi,

Von: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org]
> 
> dpybus wrote:
> >
> > I have an identical problem. I cannot deploy an app which uses either
> > Net
> 4.5
> > or 4.5.1 with the appropriate sqlite dll. It can be fixed by
> > installing
> the
> > sqlite package on the target computer.
> >
> 
> Generally, there are three types of issues with System.Data.SQLite
> deployment:
> 
> 1.  Attempting to use the native interop assembly (or native library) without
>     the necessary Microsoft Visual C++ Runtime Libraries installed.
> 
> 2.  Attempting to use the 32-bit native interop assembly (or native library)
>     in a 64-bit process or vice-versa.
> 
> 3.  Loading the managed-only System.Data.SQLite assembly in such a way that it
>     cannot locate its associated native interop assembly (or native library).
>     With the introduction [and refinement] of the "native library pre-loading"
>     feature, this frequency of this issue has declined significantly. One way
>     to see this type of issue is to install the managed-only 
> System.Data.SQLite
>     assembly in the GAC without making the associated native interop assembly
>     available somewhere in the PATH.

SharpSVN (https://sharpsvn.open.collab.net/) uses some build trickery to link
native libraries in a way that they're kept as "external resource files" along
with the assembly. This means that VS and MSBuild copy them along with the main
assembly, and it is also installed into the GAC along with the main assembly.

The trick seems to be the <AssemblyLinkResource> tag below in the vcxproj file:

    <Link>
      
<AdditionalDependencies>Advapi32.lib;shell32.lib;Rpcrt4.lib;Mswsock.lib;Crypt32.lib;User32.lib</AdditionalDependencies>
      
<AdditionalLibraryDirectories>..\..\imports\release\lib;..\..\imports\release\lib-AnyCPU;..\..\imports\release\bin;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
      
<DelayLoadDLLs>SharpSvn-DB44-20-$(Platform).svnDll;crypt32.dll;mswsock.dll;secur32.dll;user32.dll;ole32.dll;advapi32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
      
<AssemblyLinkResource>$(TargetDir)SharpSvn-DB44-20-$(Platform).svnDll;$(TargetDir)SharpPlink-$(Platform).svnExe;%(AssemblyLinkResource)</AssemblyLinkResource>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <AssemblyDebug>true</AssemblyDebug>
      <TargetMachine>MachineX86</TargetMachine>
      <KeyFile>SharpSvn.snk</KeyFile>
      <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
      <ImageHasSafeExceptionHandlers>true</ImageHasSafeExceptionHandlers>
    </Link>

It links both a DLL and an exe file that way. (The file endings are changed to 
reduce confusion of other software.)

When installing into the GAC, they both are copied along into the same 
directory as the SharpSVN Assembly itsself, where they can be found and loaded 
/ executed.

Maybe this trick could be used by System.Data.SQLlite as well - however, I'm 
currently not sure whether it is possible to create such linkage with C#, maybe 
some postprocessing is necessary.

On the other hand, SharpSVN also links a lot of native code directly into the 
DLL - using C++/CLI instead of C#, this is rather easy.

Best regards

Markus Schaber

CODESYS(r) a trademark of 3S-Smart Software Solutions GmbH

Inspiring Automation Solutions

3S-Smart Software Solutions GmbH
Dipl.-Inf. Markus Schaber | Product Development Core Technology
Memminger Str. 151 | 87439 Kempten | Germany
Tel. +49-831-54031-979 | Fax +49-831-54031-50

E-Mail: m.scha...@codesys.com | Web: http://www.codesys.com | CODESYS store: 
http://store.codesys.com
CODESYS forum: http://forum.codesys.com

Managing Directors: Dipl.Inf. Dieter Hess, Dipl.Inf. Manfred Werner | Trade 
register: Kempten HRB 6186 | Tax ID No.: DE 167014915
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to