Link to home
Start Free TrialLog in
Avatar of Wayne Barron
Wayne BarronFlag for United States of America

asked on

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

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:
BIN
  taglib-sharp.dll
  taglib-sharp.dll.refresh

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.
Carrzkiss
Avatar of Dan McFadden
Dan McFadden
Flag of United States of America image

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?

Dan
Avatar of Wayne Barron

ASKER

Hey, Dan.
VB

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

            mp3.Dispose()
        End Sub

    End Class
End Namespace

Open in new window

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
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.
ASKER CERTIFIED SOLUTION
Avatar of Wayne Barron
Wayne Barron
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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
https://blogs.msdn.microsoft.com/tolong/2006/11/16/how-to-get-your-publickeytoken/

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!!!!!!!

Carrzkiss