Hello, I am writing a small 'program' using MS Visual Studio 2013. I would like to read in a few tags from the ID3 headers of media for each file to be written to an XML file. I've used taglib and a few other ID3 libraries but I cannot use them without throwing errors. I even used the NuGet package installation for Taglib and Taglib Portable which loads the classes into my project and sets proper declarations. However, every code that I can possibly find online about using the library throws a handful of errors.

Since I am using WMP.dll as the basis of the media player part of my program I wanted to try to do it natively through Windows Media Player but the only way that I was able to find to ascertain ID3 tag values was as followed:

`Dim Artist = AxWindowsMediaPlayer1.currentMedia.getItemInfo("Author")`

But obviously this is to get the available mp3 ID3 tags from the single track that WMP is currently playing. Of course users are supposed to populate a list with mp3/other media types from a folder/subfolders and the tracks will be added to the list (this I've handled just fine) but then extract the values of the ID3 frames that I want. But I am not sure how to access such info without using the currentMedia value of my call to Windows Media Player as shown above.

Any potential thoughts/ideas would be awesome!

Have you tried Perry's ID3 Tag Library. I used this quite a while back with no problems. It's open source and he also provides an ID3 viewer using the library.

I have tried Perry's ID3 library, I used NuGet in VBStudio2013 to add TagLib# Portable and had no luck with either. Since you are more familiar with Perry's library I will attempt adding it to my project again and I will tell you the problems that arose. Perhaps you may know how I can work around it.

I went with Perry's library first as it has the most documentation including how to add it to a VBStudio project. TagLib# used to have a documentation site but it no longer exists and even if I could have gotten it to work even with adding it with NuGet, I wasn't sure where to go from there.

I am going to follow the steps posted on glassocean as far as adding Perry's library to my existing project and let you know what VBStudio says to me.

------

Downloaded V0.4 source (.sln and .vbproj)
Extracted Library folder to hard drive
File -> Add Existing Project -> Perrys ID3 Library.vbproj

PROBLEM: These projects are either not supported or need project behavior modification.....etc

I select One Way Modification to allow VBStudio to make changes for the project to be opened by VBStudio2013. I am not worried that the project can no longer be used in the original version of VBStudio in which it was created as 2013 is the only one that I use.

Perry's ID3 Library now shows in my Solution Explorer.
Under my project in the Solution Explorer I go to Project -> Add Reference -> In Reference Manager I select Project -> Solutions -> Perrys ID3 Tag Libray and click OK

PROBLEM: References between projects that target different runtimes or versions of .NET framework are not supported. The references will be treated as a file reference assemlbly....etc

I click OK

I add the following code to my existing project where necessary:

            Dim myMP3 As New ID3TagLibrary.MP3File(path)
            Dim artist = myMP3.Artist

Now, VBStudio is not marking any 'errors' within the code itself so I think maybe I'm good. But then I run debug. And a warning and error are shown:

Warning 1 Cannot unregister assembly "C:\Repository\sync\free\ID3\Perry's ID3 Tag Library\Perry's ID3 Tag Library\bin\Debug\ID3TagLibrary.dll" - file doesn't exist. Perry's ID3 Tag Library

I am not sure how to check on that location but ID3TagLibrary.dll is in the bin/debug location of the project folder where I saved it.

Error 2 Cannot register assembly "C:\Users\Mine\Documents\Visual Studio 2013\Projects\WindowsApplication5\Perry's ID3 Tag Library\Perry's ID3 Tag Library\bin\Debug\ID3TagLibrary.dll" - access denied. Please make sure you're running the application as administrator. Access to the registry key 'HKEY_CLASSES_ROOT\ID3TagLibrary.BitManipulator' is denied. Perry's ID3 Tag Library

So I am not sure where the issues lie. I am not totally positive about how to fix he administrator issue.

I apologize for this being so verbose but I am quite new to this and really would love to use this library. And if this is an issue for more people than just myself I would love to add a tutorial online for anyone else that may run into this problem with any kind of solution that might make this work for me.

I'm running Visual Studio 2010 on Windows 7 Home Premium (all updates installed). I created a sample project named 'PerryTest' and copied ID3TagLibrary.dll to the source folder. I added the dll to the References. I added the following code

Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load

    Dim mp3 As New ID3TagLibrary.MP3File("D:\My Music\Alice Cooper\Alice Cooper - Schools Out For Summer.mp3")
    Me.Close()

End Sub

then put a breakpoint at Me.Close(). With a Watch on mp3 I saw the expected properties with no errors or warnings.

Boom! Success! I wasn't sure if I would have trouble since the project might have been made in Studio 2010 considering that the last update to library was in 2012 so I didn't know if I would still have trouble in Studio 2013.

But I moved ID3TagLibrary.dll to the MyProject folder within my project's directory. Not sure if it's the best place but doesn't seem to have affected it working.

Project -> Add Reference -> Browse and select ID3TagLibrary.dll from the folder where saved and it worked.

I only mention all of this in case someone stumbles upon this thread and could use the assistance.

I upvoted your solution and will mark this thread as Solved. Thank you SO much Reverend!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.