Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / April 2006

Tip: Looking for answers? Try searching our database.

Namespace - in ASP.NET and libraries

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Xavier - 08 Apr 2006 14:57 GMT
hello,

all my libraries (dll - .NET 1.1) have there own namespace which starts with
"mycompany....."

If i have now also own classes in the application - i want also to use the
same namespace - but i see that the i can not more access the  my external
referenced libraries.

Is it not possible this - ore what must i do. I did not want to embed my
general libraries in the application (like encryption ....). The specific DAL
for the application i embed in the application - but i want to use as
namespace mycompany - name.

Also i want to have the flexibility to choose where to the code (external
dll or as internal class) and the best way is to have the same namespace.

any ideas - or recomandation?
Kevin Spencer - 08 Apr 2006 17:12 GMT
I'm not sure I understand the question. I too have several different
assemblies having namespaces that all begin with my company name, such as
DsiGlobal, DsiGlobal.Net, DsiGlobal.Imaging, etc., but they are in separate
assemblies, which must all be included in any project that employs more than
one of them. This is actually a good thing, as it doesn't necessitate
loading any code not needed by the present app. So, what exactly is the
problem?

Signature

HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Show me your certification without works,
and I'll show my certification
*by* my works.

> hello,
>
[quoted text clipped - 16 lines]
>
> any ideas - or recomandation?
Xavier - 08 Apr 2006 20:16 GMT
the problem apears in the case when in the main application i also have some
calsses with the same namespace (for example when in the asp.net application
i create  classes with a explicit entry of Namespace mycompany.....

The same problem apears if i change the namespace of the asp.net application
to mycompany.myapplication

thanks

> I'm not sure I understand the question. I too have several different
> assemblies having namespaces that all begin with my company name, such as
[quoted text clipped - 24 lines]
> >
> > any ideas - or recomandation?
Kevin Spencer - 08 Apr 2006 20:54 GMT
What problem?

Signature

HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Show me your certification without works,
and I'll show my certification
*by* my works.

> the problem apears in the case when in the main application i also have
> some
[quoted text clipped - 44 lines]
>> >
>> > any ideas - or recomandation?
Xavier - 09 Apr 2006 10:32 GMT
The error message is:
C:\Inetpub\10.118.164.237_81\WebApp1\WebForm1.aspx.vb(33): Type
'MyCompany.FBLib1' is not defined.

i show the  the steps to get reproduce error.

*in a ASP.Net application with the namespace WebApp1 there is a webform
"WebForm1.aspx"
In the webform there are to labels (Label1 and Label2) If i push the button
the following code is executed

Dim oExternalLib As New MyCompany.FBLib1
Label1.Text = oExternalLib.FBEcho("Hello")

Dim oInternalClass As MyCompany1.InternalTest.MyCompany_InternalClass
Label2.Text = oInternalClass.Test
       
 
All works ok.

The code for my internal class (in the asp,net application)
Namespace MyCompany.InternalTest
   Public Class MyCompany_InternalClass
       Public Function Test() As String
           Return "InternalTest"
       End Function
   End Class
End Namespace

BUT - if i try to change the Namespace for the internalClass from MyCompany1
to MyCompany1 then i get the error

C:\Inetpub\10.118.164.237_81\WebApp1\WebForm1.aspx.vb(33): Type
'MyCompany.FBLib1' is not defined.

i hope you understand now my problem.
best regards

> What problem?
>
[quoted text clipped - 46 lines]
> >> >
> >> > any ideas - or recomandation?
Kevin Spencer - 09 Apr 2006 13:08 GMT
> BUT - if i try to change the Namespace for the internalClass from
> MyCompany1
> to MyCompany1 then i get the error
>
> C:\Inetpub\10.118.164.237_81\WebApp1\WebForm1.aspx.vb(33): Type
> 'MyCompany.FBLib1' is not defined.

The error message indicates that your code is referencing the namespace
"MyCompany" whereas you have said that you renamed the namespace to
"MyCompany1."

Signature

HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Show me your certification without works,
and I'll show my certification
*by* my works.

> The error message is:
> C:\Inetpub\10.118.164.237_81\WebApp1\WebForm1.aspx.vb(33): Type
[quoted text clipped - 92 lines]
>> >> >
>> >> > any ideas - or recomandation?
Xavier - 09 Apr 2006 13:45 GMT
Hello Kevin,

thank for your replies, but please read carefully - when the problem apears

!!! i changed only the namespace of the internalClass from

original

> > Namespace MyCompany1.InternalTest  ' the external namespace is still MyCompany
> >    Public Class MyCompany_InternalClass
[quoted text clipped - 3 lines]
> >    End Class
> > End Namespace

to
> > Namespace MyCompany.InternalTest  'now the namespace from the internal and external call are the same
> >    Public Class MyCompany_InternalClass
[quoted text clipped - 3 lines]
> >    End Class
> > End Namespace

after this change error apears in the line
Dim oExternalLib As New MyCompany.FBLib1   '!!! ( visual studio could not
more reference the external dll  !!!! - as soon the namespace has the same
name

'for the the external class (the dll - was not modified - it has the
namespace MyCompany - but is no more visible in the asp.net class and thats
my problem

thanks

> > BUT - if i try to change the Namespace for the internalClass from
> > MyCompany1
[quoted text clipped - 103 lines]
> >> >> >
> >> >> > any ideas - or recomandation?
Kevin Spencer - 09 Apr 2006 15:34 GMT
I *did* read carefully, Xavier. However, without good information from you,
I can't be of much help.

Here's what you say the line of code that throws the error says:
> Dim oExternalLib As New MyCompany.FBLib1

Here's the error message:

> C:\Inetpub\10.118.164.237_81\WebApp1\WebForm1.aspx.vb(33): Type
> 'MyCompany.FBLib1' is not defined.

Here's your class definition:

>> > Namespace MyCompany1.InternalTest  ' the external namespace is still
>> > MyCompany
[quoted text clipped - 4 lines]
>> >    End Class
>> > End Namespace

I don't see *any* class named "FBLib1." Therefore, what you're telling me
you're doing, and what you're doing are 2 entirely different things. I can
only guess. The error message indicates that "MyCompany.FBLib1" is not
defined. I have yet to see any definition of it myself. What I *have* seen a
definition of is two classes:
"MyCompany.InternalTest.MyCompany_InternalClass" and
"MyCompany1.InternalTest.MyCompany_InternalClass".

Signature

HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Show me your certification without works,
and I'll show my certification
*by* my works.

> Hello Kevin,
>
[quoted text clipped - 149 lines]
>> >> >> >
>> >> >> > any ideas - or recomandation?
Xavier - 09 Apr 2006 17:23 GMT
sorry - here are all details to reproduce the errorr in VS2003 (.NET 1.1)

create a solution with 2 projects
    a -> a classlibrary with the Name FBlib
    b ->a asp.net application with the name Webapp1
   

1*- create a new class library (FBlib) with only a class  ( root namespace
in property of VS i deleted)
Content of the classfile FBLib1.vb

    Namespace MyCompany
       Public Class FBLib1
           Function FBEcho(ByVal vIn As String) As String
               Return vIn
           End Function
       End Class
    End Namespace
   
    2*add a  asp.net project (Webapp1) with
    a) a ClassFile - FileName MyCompany.InternalClass.vb  content:
   
    Namespace MyCompany1.InternalTest
       Public Class MyCompany_InternalClass
           Public Function Test() As String
               Return "InternalTest"
           End Function
       End Class
End Namespace

b) create a standard aspx page WebForm1.aspx with code behind
c) add a project reference to the ClassLibrary (FBLib) - created in step 1
d)add to the aspx page a 2 labels (Label1 and Label2)  and a button
e)in the button  event add please

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
       Dim oExternalLib As New MyCompany.FBLib1
       Label1.Text = oExternalLib.FBEcho("Hello-from externalLib")

       Dim oInternalClass As New
MyCompany1.InternalTest.MyCompany_InternalClass
       Label2.Text = oInternalClass.Test
   End Sub
   
3*STRG + F5 - click on the button and the aspx page will display

Hello-from externalLib
InternalTest

still here all works OK

4*error reproducion

a)change in the file from step 2a the namespace
 Namespace MyCompany1.InternalTest TO -> Namespace MyCompany.InternalTest

b)in WebForm1.aspx.vb correct the line

from Dim oInternalClass As New MyCompany1.InternalTest.MyCompany_InternalClass
 to Dim oInternalClass As New MyCompany.InternalTest.MyCompany_InternalClass
 
 
and no compilation is possible - error in line
 Dim oExternalLib As New MyCompany.FBLib1  - is displayed !!!!!!!!!!!!
 C:\Inetpub\10.118.164.237_81\WebApp1\WebForm1.aspx.vb(31): Type
'MyCompany.FBLib1' is not defined.

i hope now you can reproduce the error
thanks

> I *did* read carefully, Xavier. However, without good information from you,
> I can't be of much help.
[quoted text clipped - 179 lines]
> >> >> >> >
> >> >> >> > any ideas - or recomandation?
Kevin Spencer - 09 Apr 2006 23:06 GMT
It looks to me like you didn't update your reference. See Step 2c:

> c) add a project reference to the ClassLibrary (FBLib) - created in step 1

In your explanation, you did not mention anything about updating the
reference.

It might help if you just post the code verbatim. No need to post the code
that worked, just the code that didn't.

Signature

HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Show me your certification without works,
and I'll show my certification
*by* my works.

> sorry - here are all details to reproduce the errorr in VS2003 (.NET 1.1)
>
[quoted text clipped - 271 lines]
>> >> >> >> >
>> >> >> >> > any ideas - or recomandation?
Xavier - 10 Apr 2006 07:26 GMT
you see that in step 3 all works - i can call the function from the FBib....

The problem apears only when i change in the asp.net project the value of
the namespace how discribed in 4 a and b.

Can you please try to create this short solution how described in the steps
1 -3,4 then you could very simple reproduce the error and we could see if
this is a bug in VS2003

thanks

> It looks to me like you didn't update your reference. See Step 2c:
>
[quoted text clipped - 207 lines]
> >> >> >
> >> >> >> What problem?
Kevin Spencer - 10 Apr 2006 11:53 GMT
> Can you please try to create this short solution how described in the
> steps
> 1 -3,4 then you could very simple reproduce the error and we could see if
> this is a bug in VS2003

No, I don't have time for that. I told you what it looked like the problem
was. It is not a bug in VS.Net.

Signature

HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Show me your certification without works,
and I'll show my certification
*by* my works.

> you see that in step 3 all works - i can call the function from the
> FBib....
[quoted text clipped - 233 lines]
>> >> >> >
>> >> >> >> What problem?
Xavier - 10 Apr 2006 12:49 GMT
i fully understand that you have no time, but i think it is a bug in VSNet
because all works ok still i did not use the same Namespace as the Namespace
of the external lib.

thanks for your help.

> > Can you please try to create this short solution how described in the
> > steps
[quoted text clipped - 203 lines]
> >> >> >> >
> >> >> >> > i show the  the steps to get reproduce error.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.