Link to home
Start Free TrialLog in
Avatar of curlypinhead
curlypinheadFlag for United States of America

asked on

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

Hey,
  I'm trying to create a custom namespace that I can call from all my pages.
Here is the .vb code:

Namespace testNS
      Public Class testCls
            Public Sub testNamespace()
                  'do nothing
            End Sub
      End Class
End Namespace


The compiler command:

vbc /target:library /out:bin\testNS.dll testNS.vb


The aspx page:

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%@Import Namespace="testNS" %>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>

</body>
</html>



This doesn't do anything, but I'm using it to test.
The compiler runs without errors and creates a dll file in the \bin directory under my app folder.
When I load the aspx page I get this message:


Compiler Error Message: BC30466: Namespace or type 'testNS' for the Imports 'testNS' cannot be found.

Source Error:

Line 26: Imports System.Web.UI.HtmlControls
Line 27: Imports System.Web.UI.WebControls
Line 28: Imports testNS
Line 29:
Line 30: Namespace ASP


Source File: C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\root\d16a94c5\8b912d73\py1siljr.0.vb    Line: 28


Anyone know why this is happening?
I could use some help on this one.

Thanks,
curlypinhead
Avatar of sachiek
sachiek
Flag of Singapore image

Hi,
  I did the same you had given. It is working fine.
  I guess unless you had typed wrong Namespace or not correctly updated that DLL in bin this error will be coming for your.
  double check your namespace typed in your class file and wether DLL is correctly there in bin folder.

   To get your exact error i changed delebrately the namespace imported in aspx page to testNS1. I got the same error which you had posted above. That says all .  Hope you got it correct this time.

sachi
Avatar of curlypinhead

ASKER

I checked the spelling on all files (it looks exactly as above, in the original question).  What else could it be?  Any ideas?

Thanks,
curlypinhead
Do you have to register the dll file or something?
You dont need to register DLL.


Sachi
Hey,
  I figured out the suolution...

In IIS, you need to setup the directory for the project as an application.  Unless you do this, IIS does not look into the .\bin directory for dlls.

Please refund points.

Thanks,
curlypinhead
ASKER CERTIFIED SOLUTION
Avatar of modulo
modulo

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial