Dear Markus,

 

Thank you for your helpful comments. I’ve finally got it going on ‘naïve’
Win 8 (and Win 7) computers, but I don’t understand why!!

 

In short, I got it going by adopting the technique described here:

 

http://rashimuddin.wordpress.com/tag/sqlite-interop-dll/

 

Perhaps you can suggest why this has worked?

 

Yours Sincerely,

 

Andy Pybus

 

 

From: Markus Schaber [via SQLite]
[mailto:ml-node+s1065341n74581...@n5.nabble.com] 
Sent: Monday, 17 March 2014 9:55 PM
To: dpybus
Subject: Re: System.Data.SQLite Deployment Mystery

 

Hi, 

Von: [hidden email] [mailto:[hidden email]] 


> 
> 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;Cryp
t32.lib;User32.lib</AdditionalDependencies> 
 
<AdditionalLibraryDirectories>..\..\imports\release\lib;..\..\imports\releas
e\lib-AnyCPU;..\..\imports\release\bin;%(AdditionalLibraryDirectories)</Addi
tionalLibraryDirectories> 
 
<DelayLoadDLLs>SharpSvn-DB44-20-$(Platform).svnDll;crypt32.dll;mswsock.dll;s
ecur32.dll;user32.dll;ole32.dll;advapi32.dll;%(DelayLoadDLLs)</DelayLoadDLLs
> 
 
<AssemblyLinkResource>$(TargetDir)SharpSvn-DB44-20-$(Platform).svnDll;$(Targ
etDir)SharpPlink-$(Platform).svnExe;%(AssemblyLinkResource)</AssemblyLinkRes
ource> 
      <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: [hidden email] | 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 
[hidden email] 
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users



  _____  

If you reply to this email, your message will be added to the discussion
below:

http://sqlite.1065341.n5.nabble.com/System-Data-SQLite-Deployment-Mystery-tp
71752p74581.html 

To unsubscribe from System.Data.SQLite Deployment Mystery, click here
<http://sqlite.1065341.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscr
ibe_by_code&node=71752&code=ZHB5YnVzQGJpZ3BvbmQubmV0LmF1fDcxNzUyfDEwMTA2OTE1
Njk=> .
 
<http://sqlite.1065341.n5.nabble.com/template/NamlServlet.jtp?macro=macro_vi
ewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.Basic
Namespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.
NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_e
mails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> NAML 





--
View this message in context: 
http://sqlite.1065341.n5.nabble.com/System-Data-SQLite-Deployment-Mystery-tp71752p74659.html
Sent from the SQLite mailing list archive at Nabble.com.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to