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

by Jason Kendall » Tue, 01 Feb 2005 20:58:26 GMT

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
XXXX@XXXXX.COM

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

by Jason Kendall » Sat, 05 Feb 2005 00:43:24 GMT


<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
XXXX@XXXXX.COM



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

Similar Threads

1. 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
 XXXX@XXXXX.COM 




On Tue, 01 Feb 2005 07:58:26 -0500, Jason Kendall
< XXXX@XXXXX.COM > 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
> XXXX@XXXXX.COM 

2. Compiled .ASPX page cannot reference an assembly in the GAC - Microsoft .NET Framework

3. Compile error when using reference to own dll

* Carles Vela i Aulesa wrote, On 29-6-2007 17:24:
> Hi,
> I have a problem when I am trying to compile the .vb assembly to dll
> in VB studio 2005 Express Edition.
> 
> I have my onw dll, which looks like:
> 
> Public Class CL1
>     Public Shared Function FN1(...) As String
> 	...
>     End Function
> End Class
> (in .vb format)
> 
> and I have another assembly, in which I have an reference to my
> previous dll
> 
> Imports CL1
> Public Class CL2
>     Public Shared Function FN2(...) As String
> 	...
>     End Function
> End Class
> 
> In VB studio 2005 I created an reference to my dll assembly and all
> works fine, but when
> I try to create an dll from saved .vb file (vbc.exe /target:library c:
> \CL2.vb) I got an error:
> 
> Warning: BC40056: Namespace or type specified in the Imports
> 'DotNetNuke.Services.Upgrade' doesn't contain any public member or
> cannot be found. Make sure the namespace or the type is defined and
> contains at least one public member. Make sure the imported element
> name doesn't use any aliases.
> 
> Could someone help how to create the dll file with reference to my own
> dll?
> 
> Thanks a lot.
> 
> Jitsu
> 

You need to specify which libraries you're linking to when compiling 
from the command line. I'm a C# guy, so I don't know the vb syntax for 
this by heart. But vbc /? should get you started.

Jesse

4. Compile error when 2 pages use same codebehind file - Asp.Net

5. adding web pages Dynamically to compiled Codebehind

All,
   Wanting to find a way to create web pages to add to my website without
having to recompile the codebehind everytime I want to add a new one...

Here's the deal:
I have a web app that takes work orders for 7 different items, each item
gets 1 page for input specs.  All works well.  I want to add a new item.  I
do not want to recompile and redistribute my app everytime just to add a new
input page. Can ASPX resources be compiled into a DLL that I can easily pull
in and use and/or replace without recompiling the main app?  Any other
suggestions?
MTIA
wardeaux


6. Trying to get reference from the GAC - Visual Studio .Net/VS.net

7. Locate assemblies referenced by the interop dll

Hi,

I have the following situation:

In one folder on the harddisk i have a lot off vb stuff, i.e. C:\VBProg
In this folder there are several dll and exe files, all vb6.

I also have on the same harddisk a lot off dotnet stuff, in C:\DotNetProg
In this folder also several dll and exe files, all dotnet.

I have to write a communication between the 2 environments, so i wrote a 
dotnet dll which is registered for com interop in the C:\DotNetProg folder. 
This dll has multiple references to other dll files in this dotnet folder.

I started writing a vb program using this communication dll. As long as this 
program is in the DotNetProg everything goes well. I would like to place 
this in VBProg folder, becourse it also is going to reference several vb6 
dll files. If i do this, there is a assembly loading problem.

Is it possible to tell dotnet where to find all assemblies referenced by the 
interop dll?

Perry


8. reference a dll in codebehind without VS - Asp.Net