I am trying to use a SQLite in a Revit App but got the error shown in the image.
the dll is referenced and I put it in the directory but it didn't work.
What is the possible reason?
SQLite for .net have many versions. I do not know which version do you use, but for the Revit, which is only 64bit, I recommend to use this one:
sqlite-netFx45-binary-x64-2012-1.0.108.0.zip.
For this version, two dlls files (at least) need to be put in the app directory:
System.Data.SQLite.dll and SQLite.Interop.dll
Related
I've an app in c# and it's working perfect with Sqlite 1.0.84.0 but I should update it to 1.0.89.0.
I replace the dll and some functionalities are not working any more. Im pretty sure that is something related with SQLite.Interop.dll but I don't know how to solve it. Any idea?
Thank you in advanced for the anwer.
I suspect there is a mixup on which dll goes where and how it gets copied to the working directory.
Instead of adding references to SQLite manually, you should add it and update it using its nuget package. The package adds the proper SQLite.dll and Interop.dll files for the current SQLite version and bitness (x86 or x64) and ensures the proper Interop dlls are copied to the debug directory (x86 or x64).
SQLite is a native library so you need to have the proper version for the OS you are targetting. System.Data.SQLite is a library built on top of the native dll, which communicates whith it using the Interop dll.
I am writing a portable C# application designed to be run as a single executable file on a USB. It needs to be able to extract some data from a SQLite database. Because it is portable, installing something locally is not an option. I have seen questions like this and this but they require installing third party software.
How can I get this data without losing the portability?
Edit:
I tried using the System.Data.SQLite NuGet package. It works, but then suddenly I have gone from a single executable file to an executable, a .dll and two additional folders. I can deal (albeit unhappily) with a single dll addition, but that is too much.
You have two options:
Use IlMerge.
Embed an assembly as a resource.
Well I think is about as good as it is going to get: I got it down to a single executable and a single dll file.
To do this I changed the architecture of the executable from Any CPU to x86 only, and then installed the "System.Data.SQLite.x86" NuGet package.
If anyone knows how to keep the capability but in a single executable file, I would be very grateful.
Try Costura.Fody (browse on Nuget Packages), i usually use this one and it packs everything in a single exe, i believe it should work.
I am new to ServiceStack. I am testing out the MovieREST example. When I run the project, the Immediate Window shows me this error
"A first chance exception of type 'System.DllNotFoundException' occurred in Mono.Data.Sqlite.DLL"
and no movie list is loading up. So, there is only a blank "Add a new movie" page with some default inputs, everytime I hit Add new movie, the DllNotFoundException will be thrown.
Do I need to install any dependency projects to make it work? I am running it with VS2010, IIS, and Vista 32bit (yup..I know..). Also installed Mono and sqlite 32bit just now blindly, I am not even sure if the project needs them to run. From the code, I can see it is referring to "App_Data/db.sqlite" and References already has sqlite3.dll, I replaced the dll with the 32bit one I download anyway, but still no luck.
Please give me some hints on what I am missing? Thank you.
The Mono.Data.Sqlite.DLL is just a managed wrapper that needs to find the unmanaged sqlite3.dll in order to run (which is what holds the native binary of Sqlite itself).
It looks for this in the /bin directory, to have it deployed there whenever you build you need to copy sqlite3.dll to your project root / and set the Build Action to Content and change the Copy action to Copy if newer.
Ideally you'd want to use the right sqlite3.dll for your architecture (the ServiceStack.OrmLite.Sqlite.Mono NuGet package contains both 32bit / 64bit dlls) although IIS/.NET can work with 32bit unmanaged dlls but will require some tweaking explained here.
Using mixed-mode assemblies
Whilst Mono.Data.Sqlite.DLL lets you run the same .NET app on Mono, if you only want to run Sqlite in Windows you can also use the mixed-mode assemblies that have the unmanaged native sqlite library embedded in the .NET dll. There are 2 different versions available on NuGet:
ServiceStack.OrmLite.Sqlite32
ServiceStack.OrmLite.Sqlite64
Remove any references to existing OrmLite or Sqlite dlls as both of these NuGet packages contain all the Sqlite + OrmLite dlls needed.
I have created an application which requires the ODBC Connector to be installed on the computer to work. As my application need to connect to mysql database, it needs only one dll file (MySql.Data.dll) to work.
When i put this dll in the same location as the application it works ok. Now i want to merge this dll so that i will have only one Executable at the end ?
How can i merge this dependant DLL with my executable ?
You can't do that, all assemblies will get referenced from somewhere...
From the .NET framework path like:
System.Net.dll
All .NET apps need .NET Framework assemblies to run and that's why the user that want to execute your app needs .NET Framework installed. So your app knows where to find this assembly and won't need you to put, for example, the System.Net.dll assembly in the same path of your app for a success running.
Or from external paths like you app does.
Your app knows where to find .NET Framework assemblies to run but wait! it needs also some extra dll to run, so that's why you get the MySql.Data.dll in the same path when compiling your app.
Possible solution:
1. If you want to make just one executable try to use Spoon Studio (hard to find full cracked version and expensive to buy it). This will give you the possibility to embedded any assembly like the one you want or all .NET Framework, so this will make your app not dependant from any .NET Framework installation or needed assembly in the user computer that executes your app.
2. Try to use ILMerge, but please read below links to know if your code fits the requirements.
How to and important information:
http://www.codeproject.com/Articles/9364/Merging-NET-assemblies-using-ILMerge
http://www.blackwasp.co.uk/ILMerge.aspx
If it's a pure .NET module, you can try the ilmerge utility.
I'm using ClickOnce for installing my application written in C#. Everything worked fine till the last update after which start of my application ends with an error saying:
Could not load file or assembly MyAssembly... HRESULT: 0x80131040.
After some research I've found that there is an old version of MyAssembly located in my application's ClickOnce cache folder (C:\Documents and Settings..\Apps\2.0...). However there is an actual version in the deployment package.
I've also found this old version of MyAssembly in a standalone directory in the ClickOnce cache named after this assembly (plus some characters added).
It seems to me that for some reason ClickOnce used this old version of MyAssembly from the cache instead of the new version from the deployment package.
Uninstall/install of my application won't help.
How is this possible?
I have had the same behaviour. It mentioned the problem in another question. Since then, it has happened several times for us with different applications. One strange thing is that it behaves differently on different computers. So one computer could have been updated with the new assembly while another got the old one copied.
.NET ClickOnce deployment and wrong assemblies called after updated version
This appears to be a bug in .NET framework 3.5 SP1.
See Microsoft KB 971052.
Make sure this old assembly is loaded. You can use DllProfiler for that.