| Author |
Using Business Component
|
|
| booner 2006-02-08, 9:39 am |
| I have a business component I've built in its .vb file. Compiled the .vb
file and copied the outputted dll to the bin directory of my virtual
directory. Now in my aspx page when I attempt to utilize the business
component, I get this:
Compiler Error Message: BC30002: Type 'MyClass' is not defined
Here is the .vb file:
Imports System
Namespace myComponents
Public Class MyClass
Public Sub New()
End Sub
Public Function Authenticate(username As String, password As String) As
Boolean
return True
End Function
End Class
End Namespace
to compile the .vb file I did the following:
vbc /t:library myClass.vb
In my .aspx file:
<%@ Import Namespace="myComponents" %>
Then in some of my logic I go to use the class:
Dim misc As New MyClass
I'm using 2.0 Framework - clearly I'm a newbie (an ASP convert).
Any help you can provide would be much appreciated.
BBB
| |
| tdavisjr 2006-02-08, 9:39 am |
| This should have worked in 2.0. But try this. create a folder called
App_Code in your website directory. Then copy your myClass.vb file
there. Delete the compiled dll from the bin folder and see if you page
runs. 2.0 contains this special App_Code folder that compiles any
source file in that special folder.
Like I said, I still think what you did should have worked. The method
i'm suggesting is just an alternative to compiling the source code
yourself.
| |
| booner 2006-02-08, 9:39 am |
| Same error. I'm on a Windows 2000 box if that matters.
Looks like I have this version of the framework:
v2.0.50727
"tdavisjr" <tdavisjr@gmail.com> wrote in message
news:1138976329.390316.7920@g43g2000cwa.googlegroups.com...
> This should have worked in 2.0. But try this. create a folder called
> App_Code in your website directory. Then copy your myClass.vb file
> there. Delete the compiled dll from the bin folder and see if you page
> runs. 2.0 contains this special App_Code folder that compiles any
> source file in that special folder.
>
> Like I said, I still think what you did should have worked. The method
> i'm suggesting is just an alternative to compiling the source code
> yourself.
>
| |
| Raymond 2006-02-08, 9:39 am |
| Did you add the assembly directive in the aspx
to reference that assembly?
"booner" <b3booner@yahoo.com> wrote in message
news:2TIEf.529652$084.58394@attbi_s22...
> I have a business component I've built in its .vb file. Compiled the .vb
> file and copied the outputted dll to the bin directory of my virtual
> directory. Now in my aspx page when I attempt to utilize the business
> component, I get this:
>
> Compiler Error Message: BC30002: Type 'MyClass' is not defined
>
> Here is the .vb file:
> Imports System
>
> Namespace myComponents
>
> Public Class MyClass
> Public Sub New()
> End Sub
>
> Public Function Authenticate(username As String, password As String) As
> Boolean
> return True
> End Function
>
> End Class
> End Namespace
>
> to compile the .vb file I did the following:
>
> vbc /t:library myClass.vb
>
> In my .aspx file:
>
> <%@ Import Namespace="myComponents" %>
>
> Then in some of my logic I go to use the class:
>
> Dim misc As New MyClass
>
> I'm using 2.0 Framework - clearly I'm a newbie (an ASP convert).
>
> Any help you can provide would be much appreciated.
>
> BBB
>
>
| |
| booner 2006-02-08, 9:39 am |
| No, I did not. I was not aware I needed to. What would that look like and
what does it do? Dang newbies :-)
"Raymond" <Ray@nothere.net> wrote in message
news:HpKEf.16$H43.12@trnddc08...
> Did you add the assembly directive in the aspx
> to reference that assembly?
>
> "booner" <b3booner@yahoo.com> wrote in message
> news:2TIEf.529652$084.58394@attbi_s22...
..vb[color=darkred]
As[color=darkred]
>
>
| |
| Raymond 2006-02-08, 9:39 am |
| Well, I'm not familiar with 2.0, but from what I know
of 1.0 and 1.1, you need an assembly directive.
http://msdn.microsoft.com/library/d...conassembly.asp
"booner" <b3booner@yahoo.com> wrote in message
news:NvKEf.772358$xm3.6532@attbi_s21...
> No, I did not. I was not aware I needed to. What would that look like
and
> what does it do? Dang newbies :-)
>
> "Raymond" <Ray@nothere.net> wrote in message
> news:HpKEf.16$H43.12@trnddc08...
> .vb
String)[color=darkred]
> As
>
>
| |
| booner 2006-02-08, 9:39 am |
| Adding this to my aspx file fixed the issue:
<%@ Assembly src="myClass.vb" %>
Now to determine why. The book I'm reading makes no mention of it - and
describes compiling and placing in the bin directory as the way to do this.
"Raymond" <Ray@nothere.net> wrote in message news:gEKEf.1$xs4.0@trnddc01...
> Well, I'm not familiar with 2.0, but from what I know
> of 1.0 and 1.1, you need an assembly directive.
>
>
http://msdn.microsoft.com/library/d...conassembly.asp
>
> "booner" <b3booner@yahoo.com> wrote in message
> news:NvKEf.772358$xm3.6532@attbi_s21...
> and
the[color=darkred]
business[color=darkred]
> String)
>
>
|
|
|
|