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.

    Thanks!

    -Jason Kendall
    Jason Kendall, Feb 1, 2005
    #1
    1. Advertising

  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




    On Tue, 01 Feb 2005 07:58:26 -0500, Jason Kendall
    <> wrote:

    >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.
    >
    >Thanks!
    >
    >-Jason Kendall
    >
    Jason Kendall, Feb 4, 2005
    #2
    1. Advertising

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

    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" ?>
    <configuration>
    <system.web>
    <compilation defaultLanguage="vb" debug="false">
    <assemblies>
    <add assembly="MyCompany.Data,
    Version=1.0.4.0, Culture=neutral, PublicKeyToken=af1d58a5db022a2c" />
    </assemblies>
    </compilation>
    </system.web>
    </configuration>


    Cheers!

    -Jason Kendall





    On Tue, 01 Feb 2005 07:58:26 -0500, Jason Kendall
    <> wrote:

    >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.
    >
    >Thanks!
    >
    >-Jason Kendall
    >
    Jason Kendall, Feb 4, 2005
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Donald Sorenson
    Replies:
    2
    Views:
    440
    Donald Sorenson
    Aug 18, 2004
  2. Support
    Replies:
    3
    Views:
    4,320
    Support
    Jul 26, 2005
  3. Plasmafire
    Replies:
    1
    Views:
    7,466
    Thomas Fritsch
    Jun 19, 2007
  4. =?Utf-8?B?Wm9ycGllZG9tYW4=?=

    How do you reference a dll that is not in the GAC on a .net Web Si

    =?Utf-8?B?Wm9ycGllZG9tYW4=?=, Jul 19, 2007, in forum: ASP .Net
    Replies:
    1
    Views:
    397
    bruce barker
    Jul 19, 2007
  5. lander
    Replies:
    5
    Views:
    574
    bruce barker
    Mar 5, 2008
Loading...

Share This Page