473,507 Members | 5,257 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Mixed Language Development

AG
I am working on a web app using both C# and VB. Yes, there is a reason for
it.

All the code behind is C#.
In the web.config I have the following

<compilation debug="true">
<codeSubDirectories>
<add directoryName="VB_Code"/>
<add directoryName="Csharp_Code"/>
</codeSubDirectories>
</compilation>
There are public classes in the appropriate folders of each language type.
I can reference any class from the pages' code behind.
I can reference VB classes from the C# classes in the App_Code\Csharp_Code
folder.
I can reference VB classes from other VB classes.
I cna reference C# classes from other C# classed.

However I can't reference any C# classes from the VB classes in the
AppCode\VB_Code.
The error indicates that the class is not defined.

Can anyone explain this and possibly tell me how to reference the C# classes
from the VB classes?

TIA
--

AG
Email: discuss at adhdata dot com


Feb 3 '07 #1
6 1657
Which version of Visual Studio. I have a mixed language web-site under
development (VB, C#, and a little JScript) and I reference all three
languages with no problem. Note, your VB projects need to be DLL projects.

Mike Ober.

"AG" <NO**********@newsgroups.nospamwrote in message
news:eC**************@TK2MSFTNGP03.phx.gbl...
>I am working on a web app using both C# and VB. Yes, there is a reason for
it.

All the code behind is C#.
In the web.config I have the following

<compilation debug="true">
<codeSubDirectories>
<add directoryName="VB_Code"/>
<add directoryName="Csharp_Code"/>
</codeSubDirectories>
</compilation>
There are public classes in the appropriate folders of each language type.
I can reference any class from the pages' code behind.
I can reference VB classes from the C# classes in the App_Code\Csharp_Code
folder.
I can reference VB classes from other VB classes.
I cna reference C# classes from other C# classed.

However I can't reference any C# classes from the VB classes in the
AppCode\VB_Code.
The error indicates that the class is not defined.

Can anyone explain this and possibly tell me how to reference the C#
classes from the VB classes?

TIA
--

AG
Email: discuss at adhdata dot com




Feb 4 '07 #2
AG
Thanks for the reply Mike.
I am using VS 2005.
I am referring to mixed language development within the same project.
VS 2003 did not support that.

According to this article
http://msdn2.microsoft.com/en-us/library/ms366714.aspx
it should work.

--

AG
Email: discuss at adhdata dot com

"Michael D. Ober" <obermd.@.alum.mit.edu.no.spamwrote in message
news:xI*******************@newsread1.news.pas.eart hlink.net...
Which version of Visual Studio. I have a mixed language web-site under
development (VB, C#, and a little JScript) and I reference all three
languages with no problem. Note, your VB projects need to be DLL
projects.

Mike Ober.

"AG" <NO**********@newsgroups.nospamwrote in message
news:eC**************@TK2MSFTNGP03.phx.gbl...
>>I am working on a web app using both C# and VB. Yes, there is a reason for
it.

All the code behind is C#.
In the web.config I have the following

<compilation debug="true">
<codeSubDirectories>
<add directoryName="VB_Code"/>
<add directoryName="Csharp_Code"/>
</codeSubDirectories>
</compilation>
There are public classes in the appropriate folders of each language
type.
I can reference any class from the pages' code behind.
I can reference VB classes from the C# classes in the
App_Code\Csharp_Code folder.
I can reference VB classes from other VB classes.
I cna reference C# classes from other C# classed.

However I can't reference any C# classes from the VB classes in the
AppCode\VB_Code.
The error indicates that the class is not defined.

Can anyone explain this and possibly tell me how to reference the C#
classes from the VB classes?

TIA
--

AG
Email: discuss at adhdata dot com





Feb 4 '07 #3
Even with these changes, each assembly is still limited to a single language
and I think that's what you're running into. The site I'm developing
doesn't make the language specific support in the MSDN article - the site
itself is in C# and I have C# and VB assemblies behind it.

Mike.

"AG" <NO**********@newsgroups.nospamwrote in message
news:eh**************@TK2MSFTNGP04.phx.gbl...
Thanks for the reply Mike.
I am using VS 2005.
I am referring to mixed language development within the same project.
VS 2003 did not support that.

According to this article
http://msdn2.microsoft.com/en-us/library/ms366714.aspx
it should work.

--

AG
Email: discuss at adhdata dot com

"Michael D. Ober" <obermd.@.alum.mit.edu.no.spamwrote in message
news:xI*******************@newsread1.news.pas.eart hlink.net...
>Which version of Visual Studio. I have a mixed language web-site under
development (VB, C#, and a little JScript) and I reference all three
languages with no problem. Note, your VB projects need to be DLL
projects.

Mike Ober.

"AG" <NO**********@newsgroups.nospamwrote in message
news:eC**************@TK2MSFTNGP03.phx.gbl...
>>>I am working on a web app using both C# and VB. Yes, there is a reason
for it.

All the code behind is C#.
In the web.config I have the following

<compilation debug="true">
<codeSubDirectories>
<add directoryName="VB_Code"/>
<add directoryName="Csharp_Code"/>
</codeSubDirectories>
</compilation>
There are public classes in the appropriate folders of each language
type.
I can reference any class from the pages' code behind.
I can reference VB classes from the C# classes in the
App_Code\Csharp_Code folder.
I can reference VB classes from other VB classes.
I cna reference C# classes from other C# classed.

However I can't reference any C# classes from the VB classes in the
AppCode\VB_Code.
The error indicates that the class is not defined.

Can anyone explain this and possibly tell me how to reference the C#
classes from the VB classes?

TIA
--

AG
Email: discuss at adhdata dot com








Feb 4 '07 #4
Hello AG,

As for the mixed language problem you mentioned, it is actually due to the
natural limitation of .net framework's assembly referencing. In .net
framework, when you have two assemblies(suppose they're A and B), then
there are only two possible referencing topology. They are:

A reference B(B is referenced by A)

or

B reference A(A is referenced by B)

Two assembly can not reference each other at the same time(cross reference
is not allowed).

For your scenario, you use mixed languages to create custom class in
ASP.NET 2.0's App_code folder(by separate them into own sub directories),
though ASP.NET 2.0 support this pattern, it will actually compile those
classes(of different programming languges and in different sub folders)
into separate assemblies. As the same as above, only one assembly can
reference the other one. Here your CS classes(in cs_subdir) will be
compiled into a dynamic assembly(suppose is named dynamic_cs.dll), your VB
classes will be compiled into another assembly(named dynamic_vb.dll), so
the only supported referecing cases are:

dynamic_vb.dll reference dynamic_cs.dll(VB classes can use CS classes)

dynamic_cs.dll reference dynamic_vb.dll(CS classes can use VB classes)

I haven't got any more detailed info about how the runtime will compile the
sub directories(under App_Code), and make the reference relation ship, but
only one of the above condtions will be allowed.

Also, based on my understanding, the "App_Code" directory help to provide a
"dynamic class library" functionarlity, so each class in App_Code should be
treated as a class library, we should not rely on they can see the
other(unless they are of the same language and can be compiled into the
same assembly). The ASP.NET 2.0 application will always ensure all the page
and usercontrol can correctly reference those classes in App_Code folder.

If you do need to have full control over the reference relationship, I
would suggest you consider move some of the classes into a class library
project so that they can be precompiled into an assembly and be referenced
by the ASP.NET project. How do you think?

Hope this helps some.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Feb 5 '07 #5
AG
Thanks Steven.
At least I know what is going on. The article
http://msdn2.microsoft.com/en-us/library/ms366714.aspx is misleading.

Since most of my classes will be VB, I will probably convert the C# classes
to VB.

--

AG
Email: discuss at adhdata dot com

"Steven Cheng[MSFT]" <st*****@online.microsoft.comwrote in message
news:j4**************@TK2MSFTNGHUB02.phx.gbl...
Hello AG,

As for the mixed language problem you mentioned, it is actually due to the
natural limitation of .net framework's assembly referencing. In .net
framework, when you have two assemblies(suppose they're A and B), then
there are only two possible referencing topology. They are:

A reference B(B is referenced by A)

or

B reference A(A is referenced by B)

Two assembly can not reference each other at the same time(cross reference
is not allowed).

For your scenario, you use mixed languages to create custom class in
ASP.NET 2.0's App_code folder(by separate them into own sub directories),
though ASP.NET 2.0 support this pattern, it will actually compile those
classes(of different programming languges and in different sub folders)
into separate assemblies. As the same as above, only one assembly can
reference the other one. Here your CS classes(in cs_subdir) will be
compiled into a dynamic assembly(suppose is named dynamic_cs.dll), your VB
classes will be compiled into another assembly(named dynamic_vb.dll), so
the only supported referecing cases are:

dynamic_vb.dll reference dynamic_cs.dll(VB classes can use CS classes)

dynamic_cs.dll reference dynamic_vb.dll(CS classes can use VB classes)

I haven't got any more detailed info about how the runtime will compile
the
sub directories(under App_Code), and make the reference relation ship, but
only one of the above condtions will be allowed.

Also, based on my understanding, the "App_Code" directory help to provide
a
"dynamic class library" functionarlity, so each class in App_Code should
be
treated as a class library, we should not rely on they can see the
other(unless they are of the same language and can be compiled into the
same assembly). The ASP.NET 2.0 application will always ensure all the
page
and usercontrol can correctly reference those classes in App_Code folder.

If you do need to have full control over the reference relationship, I
would suggest you consider move some of the classes into a class library
project so that they can be precompiled into an assembly and be referenced
by the ASP.NET project. How do you think?

Hope this helps some.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

==================================================

This posting is provided "AS IS" with no warranties, and confers no
rights.

Feb 5 '07 #6
Thanks for your reply AG,

yes, the MSDN article you referenced mainly talk about referencing
multi-language code (in App_Code) from ASPX page's code, and hasn't
detailedly explain the underlying compilation structure and process.

Also, I really recommend that you submit the feedback for the document. You
can post feedback for the document through two means:

** In the document page, you can find the a bar of stars on the right top
corner, hover the mouse over it and you can submit optional feedback on
this.

** You can also directly submit feedback or request to the MSDN product
feedback center:

http://connect.microsoft.com/feedbac...spx?SiteID=210

Any of your comments are really appreciated.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.

Feb 6 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2266
by: Yang Pang | last post by:
I have a project where the GUI is in VB.NET, the libraries in unmanaged C++ which is wrapped in managed C++ and compiled as DLL. The application runs fine on Windows 2000 with VC++ development...
8
4481
by: Ted Miller | last post by:
Hi folks, I'm looking at moving a large base of C++ code to .Net under tight time constraints. The code runs in mission-critical environments, and I am extremely concerned about the loader lock...
8
1971
by: Nadav | last post by:
Hi, I am writing a performence critical application, this require me to stick to unmanaged C++ as performance is much better using unmanaged C++ ( about 33% better ), Still, I am trying to avoid...
1
1306
by: rudi | last post by:
Hi everybody, I have a problem with a mixed mode application. It consists of an unmanaged C++ dll, a "mixed mode" dll and various VB.NET dlls using the mixed mode dll to talk to the unmanaged...
6
1117
by: Arne Garvander | last post by:
Supposedly the 2.0 framework allows mixed language development. Has anyone got it to work? I know it doesn't work in the app_code directory. -- Arne Garvander Certified Geek
2
1168
by: pkcser | last post by:
Hi, I am new to .Net development, so please excuse me if some of the questions .... So I have Win32 library (using Bluetooth) and I have to expose its functionality to .Net developers. I think...
7
4787
by: =?Utf-8?B?SmltIFdhbHNo?= | last post by:
I'm new to working with mixed assemblies. All of my previous experience has been with VC++/MFC in native, unmanaged applications. When I create a mixed assembly in which one or more of the files...
6
1543
by: David Short | last post by:
I'm missing something fairly easy. I've a mixed language application running c# and DLL's of C++ and Fortran code. The application works fine on the machine with the development environment....
6
1348
by: AG | last post by:
Thanks to help from this group I was able to use both VB and C# in a Website Project, so I understand about creating language subfolders under App_Code folder. However, I have another project...
0
7221
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7313
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7372
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5619
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5039
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1537
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
758
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
411
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.