{"id":1216,"date":"2014-12-17T16:58:44","date_gmt":"2014-12-17T16:58:44","guid":{"rendered":"https:\/\/ibex.tech\/visualcpp\/?p=1216"},"modified":"2022-02-17T06:24:03","modified_gmt":"2022-02-17T06:24:03","slug":"adding-to-a-project","status":"publish","type":"post","link":"https:\/\/ibex.tech\/visualcpp\/databases\/sqlite\/adding-to-a-project","title":{"rendered":"Adding SQLite to a project"},"content":{"rendered":"<p>\nGet the latest set of files from&nbsp;<a href=\"http:\/\/system.data.sqlite.org\/index.html\/doc\/trunk\/www\/downloads.wiki\">system.data.sqlite.org<\/a>.\n<\/p>\n<p style=\"margin-left: 40px;\">\nBinary packages are intended to be used for development and deployment of their applications onto customer machines. &nbsp;Ensure you select the correct version for&nbsp;the .NET Framework version and Windows 32\/64bit version&nbsp;your applicaiton targets. &nbsp;Select the version without &#39;mixed-mode assembly&#39; bundle.\n<\/p>\n<p style=\"margin-left: 40px;\">\n(Setup packages are intended for developer machines if the design-time components for Visual Studio are required).\n<\/p>\n<p>\nSo this is what we do, we want the distribution binaries and we want them statically linked with the visual C++ runtime library in case the user doesn&#39;t already have it on their machine. &nbsp;So this is what we would choose for example:\n<\/p>\n<p style=\"margin-left: 40px;\">\nPrecompiled Statically-Linked Binaries for 32-bit Windows (.NET Framework 4.0)\n<\/p>\n<p style=\"margin-left: 80px;\">\nsqlite-netFx40-static-binary-Win32-2010-1.0.94.0.zip\n<\/p>\n<p style=\"margin-left: 40px;\">\nPrecompiled Statically-Linked Binaries for 64-bit Windows (.NET Framework 4.0)\n<\/p>\n<p style=\"margin-left: 80px;\">\nsqlite-netFx40-static-binary-x64-2010-1.0.94.0.zip\n<\/p>\n<p>\nFrom the zip copy &#39;System.Data.SQLite.dll&#39; into your project directory and then add it as a reference.\n<\/p>\n<p>\nCopy the following files \/ directories to&nbsp;your executables directory (debug and release). &nbsp;These&nbsp;don&rsquo;t need to be added as a reference in your project:\n<\/p>\n<p style=\"margin-left: 40px;\">\n\\System.Data.SQLite.dll (required, managed-only core assembly, from either zip)<br \/>\n\\System.Data.SQLite.Linq.dll (optional, managed-only LINQ assembly)<br \/>\n\\System.Data.SQLite.EF6.dll (optional, managed-only EF6 assembly)<br \/>\n\\x86\\SQLite.Interop.dll (required, x86 native interop assembly)<br \/>\n\\x64\\SQLite.Interop.dll (required, x64 native interop assembly)&nbsp;\n<\/p>\n<p>\nSet the projects .Net framework to match that used and ensure your distribution package \/ installer is set to install it as a prequesit if necessary.\n<\/p>\n<p>\nThats it! &nbsp;\n<\/p>\n<h4>\n32bit vs 64bit<br \/>\n<\/h4>\n<p>\nYour project needs to be set to the same platform architecture as that being used for the sqlite dll&#39;s. &nbsp;For C# developers this means not selectecting&nbsp;&#39;Any CPU&#39;. This means if your main executible will need to be created as 32bit and 64bit and deployed according to the target machine architecture. &nbsp;Yes sucks, but sqlite uses unmanaged code in its dll so tough!\n<\/p>\n<p>\nThe x86 and x64 directories will likely solve development issues but if not see the &quot;Using Native Library Pre-Loading&quot;&nbsp;notes <a href=\"http:\/\/system.data.sqlite.org\/index.html\/doc\/trunk\/www\/downloads.wiki\">here<\/a> for an important note about managed code applications and 64 vs 32 bit development.\n<\/p>\n<h4>\nDistributing&nbsp;Your Application<br \/>\n<\/h4>\n<p>\nThese files from your projects release output folder need to be copied into the applications executable when installed on a users PC:\n<\/p>\n<p style=\"margin-left: 40px;\">\n\\System.Data.SQLite.dll (required, managed-only core assembly)<br \/>\n\\System.Data.SQLite.Linq.dll (optional, managed-only LINQ assembly)<br \/>\n\\System.Data.SQLite.EF6.dll (optional, managed-only EF6 assembly)<br \/>\n\\x86\\SQLite.Interop.dll (required, x86 native interop assembly)<br \/>\n\\x64\\SQLite.Interop.dll (required, x64 native interop assembly)&nbsp;\n<\/p>\n<p>\nEnsure the relevant .Net framework is used.\n<\/p>\n<h4>\nIssues<br \/>\n<\/h4>\n<p>\nC# application targetting &#39;Any CPU&#39; may cause errors and need to be set to the same 32\/64 bit version as that downloaded.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Get the latest set of files from&nbsp;system.data.sqlite.org. Binary packages are intended to be used for development and deployment of their applications onto customer machines. &nbsp;Ensure you select the correct version for&nbsp;the .NET Framework version and Windows 32\/64bit version&nbsp;your applicaiton targets. &nbsp;Select the version without &#39;mixed-mode assembly&#39; bundle. (Setup packages are intended for developer machines if [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[104],"tags":[],"class_list":["post-1216","post","type-post","status-publish","format-standard","hentry","category-sqlite"],"_links":{"self":[{"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/posts\/1216","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/comments?post=1216"}],"version-history":[{"count":14,"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/posts\/1216\/revisions"}],"predecessor-version":[{"id":1343,"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/posts\/1216\/revisions\/1343"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/media?parent=1216"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/categories?post=1216"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/tags?post=1216"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}