We help IT Professionals succeed at work.

TagLib MP3 tag Reader get this error: Type 'TagLib.File' is not defined. (On website, outside of VS)

Last Modified: 2018-05-22
Hello all;

I am using TagLib from here: http://download.banshee.fm/taglib-sharp/ (https://github.com/mono/taglib-sharp)
I have it working within VS.
However, I am designing a website with it, and I need it to run on the website.

When I created the project within VS, and Referenced the .dll files
It put the dll files inside of:

The Bin folder is also located on the website.

I added all these and they are all grayed out.
Tells me they are not necessary

Imports TagLib
Imports TagLib.IFD
Imports TagLib.IFD.Tags
Imports TagLib.Xmp

I also registered the .dll file with Windows, using the following command.

%windir%\microsoft.net\framework\v2.0.50727\regasm G:\InetPub\wwwroot\Media\WebSite1\Bin\taglib-sharp.dll /codebase

Open in new window

And I still get the error.
Type 'TagLib.File' is not defined.

Any idea's on this would be great.
Watch Question

Dan McFaddenSystems Engineer

I tend to think one of these situations has occurred:

1. a reference to the assembly(ies) was not registered to the project
2. the namespace is not being properly declared in the project

Reference link:  https://msdn.microsoft.com/en-us/library/sy234eat.aspx

Are you coding in C# or VB.NET?

Wayne BarronAuthor, Web Developer
Top Expert 2009


Hey, Dan.

I tried doing this
Namespace TagLib
end namespace

And I get a label1 is not declared

This is a sample of the test project I have.
Namespace TagLib
    Partial Class _Default
        Inherits System.Web.UI.Page

        Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
            Dim mp3 As TagLib.File = TagLib.File.Create("G:\VS_Lessons\Media\WebSite1\01Fantasy.mp3")
            Dim strTitle As String = mp3.Tag.Title
            Dim strDuration As String = mp3.Properties.Duration.ToString("mm\:ss")
            Dim strYear As String = mp3.Tag.Year
            Dim strTrackNumber As String = mp3.Tag.Track
            Dim strAlbum As String = mp3.Tag.Album
            'Dim strArtist As String = mp3.Tag.Artists
            Dim strGenre As String = mp3.Tag.FirstGenre

            Label1.Text = "Album: " + strAlbum

        End Sub

    End Class
End Namespace

Open in new window

Wayne BarronAuthor, Web Developer
Top Expert 2009


I did this in my default.aspx file
(Added the Inherits="TagLib._Default")
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="TagLib._Default" %>

Open in new window

Fixed the error with the Label1.
However, still getting
error: Type 'TagLib.File' is not defined
Wayne BarronAuthor, Web Developer
Top Expert 2009


I tried changing the .net framework of the project, as I read that the error can be caused by running a different version of .net.
However, that did not work either.
Author, Web Developer
Top Expert 2009
Unlock this solution and get a sample of our free trial.
(No credit card required)
Wayne BarronAuthor, Web Developer
Top Expert 2009


Did a LOT of search and research to find this one.
I knew from working with Delphi development years ago, that if you work with a 3rd DLL file, then you have to reference it and distribute that file with your package to the consumer.
So, with that thinking.
I did research on Google for asp.net DLL on webpage.
And I found  this link

You have to run it as Administrator, and it works like a charm.
Have a good one.
I am completely psyched now. You all just have no idea.
This is so exciting, now I get to work on designing the site around this.
Years in the planning and I finally have the knowledge.

LOVE IT!!!!!!!


Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.