CFF KB - Carrz-Fox-Fire Promotions Knowledge Base

CFF KB is all about 1 thing: The Sharing of Knowledge and the Power we gain from it.
  • Breadrumbs:
  • TYPE 'ExifReader' IS NOT DEFINED

  • CFF Knowledge Base - Share With Facebook CFF Knowledge Base - Share on Twitter CFF Knowledge Base - Share on Reddit CFF Knowledge Base - Share on Digg It CFF Knowledge Base - Share on Stumble Upon It CFF Knowledge Base - Share on Delicious
    Share With Friends (Updated 6-8-2010)
  • Article ID:
    3237
  • Date Created
    Wednesday, December 15, 2021
  • Last Updated
    Wednesday, December 15, 2021
  • This Article Has been Viewed
    666 times
  • Short Desc
    Using the ExifLib.dll on a website without a reference to the DLL library, you will receive Type 'ExifReader' is not defined.
  • Details
    When using Visual Studio, you add a reference to the ExifLib.dll, which will add files to the /bin folder within your website directory. You can then make references to the Library using simple code like this.

    Code supplied by Snarf0001.
    <%

    Dim make As String
    Dim model As String

    Using exReader As New ExifReader(fileName)
    exReader.GetTagValue(Of String)(ExifTags.Make, make)
    exReader.GetTagValue(Of String)(ExifTags.Model, model)
    End Using

    lblMake.Text = make
    lblModel.Text = model

    %>
  • Recreate Issue
    To Reproduce this issue.

    Using the code above that works within Visual Studio does not work in a website without referencing the DLL file within your project.
  • Resolve Issue
    To Resolve this issue.

    This is taken from the blogs over at Microsoft. Thanks to their Blog Member. tolong« for this information.

     

    Using the Visual Basic Developer Command Prompt.
    Click on your [Start] Menu.
    Choose [Programs]
    Scroll down to the [Visual Studio 2015] (your Version number here)
    Choose [Developer Command Prompt for VS2015] (your Version number here)

    When the window opens, do the following commands.
    C:\Windows\system32>
    type in
    cd G:\ (Replacing the G with the drive you have your DLL files at)
    G:\>
    Type in cd Packages (To in the rest of the location here, and hit Enter)
    G:\Packages>
    NEXT
    G:\Packages>gacutil -i ExifLib.dll
    If successful, you will receive this message.
    [Microsoft (R) .NET Global Assembly Cache Utility. Version 4.0.30319.0
    Copyright (c) Microsoft Corporation. All rights reserved.

    Assembly successfully added to the cache]
    NEXT
    G:\Packages>gacutil -l ExifLib
    If successful, you will receive this message.
    [Microsoft (R) .NET Global Assembly Cache Utility. Version 4.0.30319.0
    Copyright (c) Microsoft Corporation. All rights reserved.

    The Global Assembly Cache contains the following assemblies:
    ExifLib, Version=1.7.0.0, Culture=neutral, PublicKeyToken=30284005913968db, processorArchitecture=MSIL

    Number of items = 1]

    The above string you will need.
    >> ExifLib, Version=1.7.0.0, Culture=neutral, PublicKeyToken=30284005913968db, processorArchitecture=MSIL

    Now, with the above done, you will need to add that information into your web.config file.
    Which will look like this.

    <%

    <?xml version="1.0"?>
    <configuration>
    <system.web>
    <compilation debug="true" strict="false" explicit="true" targetFramework="4.5">
    <assemblies>
    <add assembly="ExifLib, Version=1.7.0.0, Culture=neutral, PublicKeyToken=30284005913968db, processorArchitecture=MSIL"/>
    </assemblies>
    </compilation>
    </system.web>
    </configuration>

    %>


    You will then be able to run your ExifLib website on your server.



    how-to-get-your-publickeytoken«


    --------
    Related Articles
    Type 'TagLib.File' is not defined«