How to Add NAudio to my Project? - c#

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

Related

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. :)

Working with Sqlite.dll error

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

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. :)

Could not load System.Net.Http.Primitives or one of its dependencies...gmail API

I am aware of the other question on this topic. Unfortunately, that question did not solve the problem.
My problem is outlined almost to the letter in this question. I am running the gmail-api in c# and the authenticator is complaining that it cannot find the System.Net.Http.Primitives file. I have followed all the steps of the answer--both steps 1 and 2.
Yet, the code still isn't finding the .Primitives version 4.2.29 (the current version of the primitives file). Is there another step to making sure the code can find the primitives file? I have updated all of the nuget packages in the solution to the latest versions. The primitives file is both present in the project and has been redirected to in the App.config file.
Somehow, installing the gmail api into only the .dll where it was called wasn't enough. Instead, I had to install it in all of the projects involved...in this case, the .dll and the unit testing project. That cleared up the problem.
Still have no idea why.

Complile A DLL From Github

I have found a great dev on github who has some great code i am using at the moment. I need to edit one of the files referenced in the DLL (that i referenced from nuget).
https://github.com/flagbug/YoutubeExtractor
luckily the dev has all the .cs files available on github to download. I have made the changes i need to his code but have no idea on how to compile them into a dll for use in my project.
What should i start researching - it is something i have never even remotely had to do before. If anyone has a link to a guide i could follow or a good starting point to learn from i would appreciate it.
thanks!
Start by downloading the project from GitHub. Then open the solution file in Visual Studio and make the necessary changes to the source code. Then compile. Finally reference the compiled assembly into your application (don't use the official NuGet).
Or if you want to use the NuGet you will have to build it by yourself with the changes you have made to the source code and then reference the new NuGet.
After you have completed those changes you might submit a Pull Request to the author on GitHub so that he can integrate your changes directly into his repository and make them available through his NuGet.

Categories

Resources