@assembly directive questions

S

Steve Richter

I am attempting to use the IBM DB2Connection class in my .aspx web
page.

Using Visual Web Developer 2005 express, I cant figure out how to add a
reference to a project. heck, I cant figure out how to open a project!


so I am trying to use the @assembly directive to point directly to the
assembly .DLL that contains the DB2 namespace:

<%@ Assembly src="\db2_f11\ibm.data.db2.dll" %>

where db2_f11 is a virtual path that is mapped to C:\Program
Files\IBM\SQLLIB\BIN\netf11

When I point IE to my .aspx file I get an error, "no build provider
registered for the extension '.dll' " Which makes no sense to me. Why
do I have to build a DLL? Isnt it already built?

The question is: how do I reference this assembly in my .aspx web page?

thanks,

-Steve

Parser Error Message: There is no build provider registered for the
extension '.dll'. You can register one in the
<compilation><buildProviders> section in machine.config or web.config.
Make sure the appliesTo attribute includes the value 'Web' or 'All'.

Source Error:

Line 1: <!-- DemoPage.aspx : demonstration web page -->
Line 2: <%@ Page Language="C#" %>
Line 3: <%@ Assembly src="/db2_f11/ibm.data.db2.dll" %>
Line 4: <%@ Import Namespace="IBM.Data.DB2" %>
Line 5: <%@ Import Namespace="System.Data" %>
 
B

Brock Allen

You should either add a reference by copying the dependent DLLs into your
~/bin directory, or if the DLLs you need are in the GAC then you can use
the @assembly by specifying the assembly's fully qualified name:

<%@ Assembly Name="SomeAssemblyNameWithOutTheDLLExtension, Culture=neutral,
Version=1.2.0.0, PublicKeyToken=38218fe715288aac" %>

The Version and PublicKeyToken you should gte from looking in the GAC (which
is c:\windows\assembly).
 
S

Steve Richter

Brock said:
You should either add a reference by copying the dependent DLLs into your
~/bin directory, or if the DLLs you need are in the GAC then you can use
the @assembly by specifying the assembly's fully qualified name:

<%@ Assembly Name="SomeAssemblyNameWithOutTheDLLExtension, Culture=neutral,
Version=1.2.0.0, PublicKeyToken=38218fe715288aac" %>

The Version and PublicKeyToken you should gte from looking in the GAC (which
is c:\windows\assembly).

there is an entry for IBM.Data.DB2 in the GAC.

I add this stmt to my .aspx file:
<%@ Assembly Name="IBM.Data.DB2" %>

( version= and PublicKeyToken= are not allowed )

I get a "not found" error message. I dont want to copy the assembly dll
from where it was installed, that does not seem to be a good idea in
this case.

thanks,
-Steve

Parser Error Message: File or assembly name 'IBM.Data.DB2', or one of
its dependencies, was not found.

Source Error:

Line 2: <%@ Page Language="C#" %>
Line 3: <!-- xxx Assembly src="/db2_f11/ibm.data.db2.dll" %> -->
Line 4: <%@ Assembly Name="IBM.Data.DB2" %>
Line 5: <%@ Import Namespace="IBM.Data.DB2" %>
Line 6: <%@ Import Namespace="System.Data" %>
 
B

Brock Allen

I add this stmt to my .aspx file:
<%@ Assembly Name="IBM.Data.DB2" %>
( version= and PublicKeyToken= are not allowed )

Why are version and public key token not allowed? How else are you going
to tell ASP.NET which version you want? Those are required, in fact.
I dont want to copy the assembly
dll from where it was installed, that does not seem to be a good idea
in this case.

Probabaly not.
 
S

Steve Richter

Brock said:
Why are version and public key token not allowed? How else are you going
to tell ASP.NET which version you want? Those are required, in fact.

your right Brock. This stmt worked for me:

<%@ Assembly Name="IBM.Data.DB2, Culture=neutral,
Version=8.1.2.1, PublicKeyToken=7c307b91aa13d208" %>

( why the Visual Web Developer did not like it when I first entered it
but now has no problem with it, who knows! )

thanks for your help,

-Steve
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,992
Messages
2,570,220
Members
46,805
Latest member
ClydeHeld1

Latest Threads

Top