TagLib.Sharp on a website (vb.net) (Type 'TagLib.File' is not defined)

北城余情 提交于 2021-02-18 19:34:58

问题


(Coding for VB.NET)

I am working with the TagLib-Sharp. I really enjoy how it works. Very simple and straight forward. Well, within VS, it is, anyway.

I took the files and placed them on my web server, of which included the BIN folder that VS created with the DLL files when I referenced the TagLib-Sharp.dll file.

When I run the site through my browser, I get the following error.

Type 'TagLib.File' is not defined

I was told that I had to create a Namespace for it, so I did that. I also included all the IMPORTS for the different taglib's and that did not work.

Here is the code that I am working with.

default.aspx

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="TagLib._Default" %>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</div>
</form>

default.aspx.vb

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

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:\InetPub\wwwroot\Media\m.mp3")
        Dim strAlbum As String = mp3.Tag.Album

        Label1.Text = "Album: " + strAlbum
        mp3.Dispose()
    End Sub

End Class
End Namespace

I also registered the DLL file with my system.

%windir%\microsoft.net\framework\v2.0.50727\regasm G:\WebFiles\taglib-sharp.dll /codebase

I also read about this error, where it deals with the .NET version that was used for the file and what the project is made with.

I changed the version of .net down to 2.5 and then up to 3.5 and then back to 4.5 and it did not matter. Nothing seemed to work. (Other than a lot of errors when I went down to 2.5, it was a mess)

But nothing seems to be working. Any idea's on this would be wonderful. Reading the mp3 metadata is something that I have been wanting to add to an ongoing project for many years. And I am this close, but cannot seem to cross that finish line.

Thanks in advance for all assistance on this annoying issue.

CodingEE


回答1:


OK, for anyone that runs into this issue.

This is how you fix it.

https://blogs.msdn.microsoft.com/tolong/2006/11/16/how-to-get-your-publickeytoken/

Works like a charm. I am now viewing the site on a web server. NICE!!!!!

CodingEE



来源:https://stackoverflow.com/questions/43008630/taglib-sharp-on-a-website-vb-net-type-taglib-file-is-not-defined

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!