Working with Sqlite.dll error - c#

I am trying to make a small application, working with SQLite. However I am running into problems whose solutions on the Net are horribly outdated and nothing I tried works, currently I feel like I have no idea what I am doing.
My problem:
Can't add a reference to SQLite.dll "A reference to sqlite3.dll could not be added. Please make sure that the file is accessible, and that it is a valid assembly or COM component."
What I've tried:
As far as I know in order to use SQLite in C# code I need to add a reference to an SQLite.dll. I went to the Downloads page of SQLite and downloaded precompiled binaries for Windows (mainly because I have no idea what any of those things are). That didn't work, searched on the 'Net:
Tried both the x32 and x64 version
Installed "SQLite for Windows Runtime" extension
Installed SQLite tools, included them in PATH variable
The only *.dll I could get going was from a Codeproject example which had a sqliteNet.dll file (I have no idea from where) but that had other problems.
From what I looked for all the information/questions/tutorials about SQLite on the Net are horribly outdated and are no help to me.
Currently I am literally lost and have NO idea why it doesn't work and what I should do, please someone help me!

can you use the nuget package for sqlite "System.Data.SQLite"?
Since you need a wrapper to the c-dll you should try some nuget package that wraps it already.

If you haven't tried this method then you have to test it.
Right Click on your Project
Click on Manage NuGet Packages..
In Browse tab search System.Data.SQLite & select it
On Right side click on Install button
After installing you can use it

Related

Visual Studio-Code is not finding Library

I am setting up a simple console project to connect to a database using a connection string. My problem is the project is NOT finding one of the required libraries at runtime.
When I run the console app the application fails.
I go look at the csproj file to ensure I have added the library. I run the command 'dotnet restore -force'. and it finds the library and reports no errors.
The same code works on other developer machines (Windows laptops) but it does not work on my MAC. I am using NuGet Package Manager and NuGet Gallery to ensure I have installed them correctly. I have uninstalled the libraries and re-installed them. It still does not work.
Have I done something wrong? Any suggestions or recommendations would be helpful.
After a lot of searching I found a work around.
I change the usage from System.Extensions to MicroSoft.Extensions.Configuration. I followed the instructions form this question on how to get the connection string.

How to Add NAudio to my Project?

so, sorry if this is a stupid question, but I've been working with audio a lot, and I'm going to try out NAudio, so I went to the website (which, by the way, is blocked in Chrome), and downloaded it. Then I searched and searched through the files. Most of the folders don't even include any .dll files, and those that did didn't have one that made sense to reference to. So then I went back to the website and looked around, and I've searched and searched on the internet for things relating to "how to add NAudio to your project" or "How to link NAudio", and I've come up with nothing.
How can I add NAudio to my project?
Run this in your package manager.
Install-Package NAudio -Version 1.8.4
It will automatically add all required reference, you can remove the version flag "-Version 1.8.4" to install latest version
The website you linked to is on Codeplex which is depricated. The current place for NAudio is on github: https://github.com/naudio/NAudio/wiki/Getting-Started
Set a package reference to NAudio on nuget.org: https://www.nuget.org/packages/NAudio/
This will pull in the package and set references to the correct dlls

TagLib is not working [duplicate]

I'm having a bunch of troubles with this library (obviously because I'm a newbie). I'm using Microsoft Visual Studio 2015.
First of all I have absolutely no idea on how to add this library to my project. I didn't find anything helpful on Google, either.
And second, I've found two different libraries - taglib-sharp-master and taglib-sharp-2.1.0.0-windows. Which one should I use?
There are a few things you'll want to do in order to get taglib-sharp working in your project.
Firstly, you need to stick to a particular project type. Next, you are to install the suitable library version for that project. Next, you can use the library as you wish to. I shall also provide a minimal example to get you started and a link to a bunch of examples which you might find of help.
Choosing the correct version of TagLib:
There's some ambiguity in your question as you have tagged it with both c++ and c#. If you want to use c++ in your project, then your best bet is to use the taglib library. Note: Not the 'sharp' version.
However, almost the entire question and its title speaks of taglib-sharp. Given that, I shall presume that you are using c# for your project. Accordingly, your project is a .NET C# project. You can obviate the quandary over selecting the project type. Any of the project types (WinForms, WPF, Console Application will work just fine as taglib-sharp is just an off-screen library.
And also, FYI, both taglib-sharp-master and taglib-sharp-2.1.0.0-windows are essentially the same stuff. The former is probably the latest version since the latter specifies a definite version 2.1.0.0. But again, 2.1.0.0 has long been the latest version of taglib-sharp. So, use either, and you should be fine.
Installing TagLib-Sharp a.k.a. TagLib#:
Next up, you must install TagLib-Sharp to your project. There are a few ways to do so:
Install it via Nuget
Add a reference to the binary
♦  Installing via Nuget:
This is probably the recommended way of installing any library/component in Visual Studio. Head over to the Nuget Package Manager Console. Once there, type in:
Install-Package taglib
Nuget Package link: Taglib-Sharp.
and press ENTER.
For more information on the Nuget Package Manager Console, how to open it and use it, visit this link.
You can also add it with the help of the Nuget Package Manager (GUI). Open the Package Manager and search for "taglib-sharp". Install the appropriate package that shows in the search results.
For more information on the Nuget Package Manager, how to open and use it, visit this link.
♦  Downloading the binary and adding a reference to it directly:
You can download the latest version of the taglib-sharp binaries here. The download is a .zip archive. Unzip the file.
In the unzipped folder, head over to \Libraries. There, find the taglib-sharp.dll file. Keep a note of where the file is located.
Next, in Visual Studio, go to Project > Add Reference.
There, in the left panel, select Browse. Now in the dialog buttons section, click browse and locate the .dll file you extracted from the .zip archive. Make sure the CheckBox next to it is checked:
Click OK.
Now you are all set to use TagLib-Sharp.
Using TagLib-Sharp (Examples):
The minimal example of using the library would be opening a file and editing its Title property and retrieving the Year property:
var file = TagLib.File.Create("<yourFile.mp3>"); // Change file path accordingly.
file.Tag.Title = "My Own Song";
var year = file.Tag.Year;
// Save Changes:
file.Save();
You can also find a similar example here to get your started.
More examples:
Set Bitmap as cover art for MP3
https://github.com/mono/taglib-sharp/tree/master/examples
https://www.codeproject.com/messages/3009089/extracting-id3-albumart-with-taglib-sharp.aspx
If you have further queries, feel free to ask in the comments below. And also, if the question deserves a separate thread, word it properly and ask it here on Stack Overflow itself.
Hope this answer helps. :)

How do I use taglib-sharp?

I'm having a bunch of troubles with this library (obviously because I'm a newbie). I'm using Microsoft Visual Studio 2015.
First of all I have absolutely no idea on how to add this library to my project. I didn't find anything helpful on Google, either.
And second, I've found two different libraries - taglib-sharp-master and taglib-sharp-2.1.0.0-windows. Which one should I use?
There are a few things you'll want to do in order to get taglib-sharp working in your project.
Firstly, you need to stick to a particular project type. Next, you are to install the suitable library version for that project. Next, you can use the library as you wish to. I shall also provide a minimal example to get you started and a link to a bunch of examples which you might find of help.
Choosing the correct version of TagLib:
There's some ambiguity in your question as you have tagged it with both c++ and c#. If you want to use c++ in your project, then your best bet is to use the taglib library. Note: Not the 'sharp' version.
However, almost the entire question and its title speaks of taglib-sharp. Given that, I shall presume that you are using c# for your project. Accordingly, your project is a .NET C# project. You can obviate the quandary over selecting the project type. Any of the project types (WinForms, WPF, Console Application will work just fine as taglib-sharp is just an off-screen library.
And also, FYI, both taglib-sharp-master and taglib-sharp-2.1.0.0-windows are essentially the same stuff. The former is probably the latest version since the latter specifies a definite version 2.1.0.0. But again, 2.1.0.0 has long been the latest version of taglib-sharp. So, use either, and you should be fine.
Installing TagLib-Sharp a.k.a. TagLib#:
Next up, you must install TagLib-Sharp to your project. There are a few ways to do so:
Install it via Nuget
Add a reference to the binary
♦  Installing via Nuget:
This is probably the recommended way of installing any library/component in Visual Studio. Head over to the Nuget Package Manager Console. Once there, type in:
Install-Package taglib
Nuget Package link: Taglib-Sharp.
and press ENTER.
For more information on the Nuget Package Manager Console, how to open it and use it, visit this link.
You can also add it with the help of the Nuget Package Manager (GUI). Open the Package Manager and search for "taglib-sharp". Install the appropriate package that shows in the search results.
For more information on the Nuget Package Manager, how to open and use it, visit this link.
♦  Downloading the binary and adding a reference to it directly:
You can download the latest version of the taglib-sharp binaries here. The download is a .zip archive. Unzip the file.
In the unzipped folder, head over to \Libraries. There, find the taglib-sharp.dll file. Keep a note of where the file is located.
Next, in Visual Studio, go to Project > Add Reference.
There, in the left panel, select Browse. Now in the dialog buttons section, click browse and locate the .dll file you extracted from the .zip archive. Make sure the CheckBox next to it is checked:
Click OK.
Now you are all set to use TagLib-Sharp.
Using TagLib-Sharp (Examples):
The minimal example of using the library would be opening a file and editing its Title property and retrieving the Year property:
var file = TagLib.File.Create("<yourFile.mp3>"); // Change file path accordingly.
file.Tag.Title = "My Own Song";
var year = file.Tag.Year;
// Save Changes:
file.Save();
You can also find a similar example here to get your started.
More examples:
Set Bitmap as cover art for MP3
https://github.com/mono/taglib-sharp/tree/master/examples
https://www.codeproject.com/messages/3009089/extracting-id3-albumart-with-taglib-sharp.aspx
If you have further queries, feel free to ask in the comments below. And also, if the question deserves a separate thread, word it properly and ask it here on Stack Overflow itself.
Hope this answer helps. :)

Add FreeImage .NET to solution

I have followed the posts on this, but i am still not getting a few steps. I am new to C#, and that is probably the issue. I would love a little help (I have been banging on this all day).
I can open the FreeImage.NET solution (Win7 64 bit machine btw) in Visual Studio. This post says i need to Build it to get the C# dll. When i build it, i get hundreds of errors "type or namespace 'Name' could not be found".
Does it need the C++ DDL added first? I dragged and dropped it onto the solution, but still the errors.
Am i doing something simple and wrong?
Specifically what i am trying to do is add FreeImage to project in C# Visual Studio Express 2012.
Thanks,
Dan
After downloading the version of FreeImage.NET , I opened the following VS2005 Solution File in VS2012.(Thats the only one I have)
FreeImage3154\FreeImage\Wrapper\FreeImage.NET\cs\FreeImage.NET.2005.sln
After upgrading the project and building it for the first time, I saw around 491 errors. If you open the references of the UnitTest.2005 project, you will see that the nunit.framework assembly is missing. If you have nuget installed , in VS2012 you can
Right Click references > Manage NuGet Packages > Search for NUnit and install it.
In the image below we see that the nunit.framework assembly is correctly linked.
After doing this there were only 50 errors remaining and they were all because the Xml Documentation file checks were enabled. You can disable this check as shown below in the Library.2005 project.
Build again, and it should succeed.
NOTE: The FreeImage website provides only a 32-bit version of the DLL, thus to use this DLL you will have to ensure that you set your project version to 32-bit. To obtain a 64-bit version of the FreeImage DLL you will have o download their source code project and manually do a 64-bit build as show in this blog.

Categories

Resources