Trying to reference a DLL (located in the GAC) from a JIT compiled page using codebehind.

Discussion in 'ASP .Net' started by Jason Kendall, Feb 1, 2005.

  1. I've got a simple report that I'm building. This is just a single web
    page. It uses a custom DLL that I've built as an interface to my
    database. When I use th page within an ASP.Net project, in Visual
    Studio, I can set a reference to my DLL, Import the namespace, and
    everything works perfectly.

    However, when I convert the page to a JIT scenario so that I can
    publish both the .ASPX page and the associated .VB file and not have
    to deploy a compiled DLL for this one simple report, I get the error:

    BC30466: Namespace or type 'Data' for the Imports 'MyCompany.Data'
    cannot be found.

    This looks like the compiler has no reference to the DLL to link in.
    I would prefer to do this at the page level, but I'll do it in the
    web.config too, if necessary. I've been all over Google and MSDN and
    just can't seem to find anything that tells me how to add the
    reference outside of Visual Studio.


    -Jason Kendall
    Jason Kendall, Feb 1, 2005
    1. Advertisements

  2. <bump>

    Someone's got to have done this before. Surely I don't need to
    compile my on lonely report into a DLL just to be able to reference an
    external DLL in the GAC.

    -Jason Kendall
    Jason Kendall, Feb 4, 2005
    1. Advertisements

  3. I finally found the answer for myself, which I will provide below:

    All I needed to do was to add a web.config in the folder containing my
    JIT compiled report and add an "assemblies" section specifying to
    "add" my assembly using the information described in the GAC.

    Nothing could be easier and I have all the benefits I had hoped to
    have. It's so easy that I'm surprised that none of the local experts
    could solve this one.

    <?xml version="1.0" encoding="utf-8" ?>
    <compilation defaultLanguage="vb" debug="false">
    <add assembly="MyCompany.Data,
    Version=, Culture=neutral, PublicKeyToken=af1d58a5db022a2c" />


    -Jason Kendall
    Jason Kendall, Feb 4, 2005
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.