Monday, March 26, 2012

Why my Namespace cannot found?

I put my file in "C:\Inetpub\wwwroot\net"

I have a .vb file as below: (test_others_otherfunctions.vb)

Imports System.Data
Imports System.Data.SqlClient
Imports Microsoft.VisualBasic
Imports System.Collections

Imports System.Security.Cryptography
Imports System.Text


Namespace TEST

Namespace OTHERS

Public Class OtherFunctions

Public Function GetTimeStamp() as String
dim TimeStamp as String = "Testing 123 v321"
return TimeStamp
End Function

End Class

End Namespace

End Namespace

##################################################

After compiled, the .dll file will copy to "C:\Inetpub\wwwroot\net\bin\test_others_otherfunctions.dll"

my index.aspx code in "C:\Inetpub\wwwroot\net\" as below:

<%@dotnet.itags.org. Page Language="VB" Debug="True" %>
<%@dotnet.itags.org. import Namespace="TEST" %>
<script runat="server">

Sub Page_Load(Sender As Object, E As EventArgs)
Dim oth_function As New OTHERS.OtherFunctions
Dim timestamp as String = oth_function.GetTimeStamp()

Response.write (timestamp)
End Sub

</script>

###############################################

i have create a compile.bat file as below:

vbc /t:library /r:System.Data.dll /r:System.dll test_others_otherfunctions.vb

copy *.dll c:\inetpub\wwwroot\net\bin

##############################################

my error message in index.aspx as below:

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

##########################################

May i know what is the problems? Thank you.

p/s: the .dll file must put into a bin folder?

Rgs,

Fslim

Here, TEST is not a valid namespace. TEST.OTHERS is.

0 comments:

Post a Comment