473,666 Members | 2,048 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">
<codeSubDirecto ries>
<add directoryName=" VB_Code"/>
<add directoryName=" Csharp_Code"/>
</codeSubDirector ies>
</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 1668
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**********@n ewsgroups.nospa mwrote in message
news:eC******** ******@TK2MSFTN GP03.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">
<codeSubDirecto ries>
<add directoryName=" VB_Code"/>
<add directoryName=" Csharp_Code"/>
</codeSubDirector ies>
</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.spam wrote in message
news:xI******** ***********@new sread1.news.pas .earthlink.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**********@n ewsgroups.nospa mwrote in message
news:eC******** ******@TK2MSFTN GP03.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">
<codeSubDirecto ries>
<add directoryName=" VB_Code"/>
<add directoryName=" Csharp_Code"/>
</codeSubDirector ies>
</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\Cshar p_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_Cod e.
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**********@n ewsgroups.nospa mwrote in message
news:eh******** ******@TK2MSFTN GP04.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.spam wrote in message
news:xI******** ***********@new sread1.news.pas .earthlink.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**********@n ewsgroups.nospa mwrote in message
news:eC******* *******@TK2MSFT NGP03.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">
<codeSubDirecto ries>
<add directoryName=" VB_Code"/>
<add directoryName=" Csharp_Code"/>
</codeSubDirector ies>
</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\Csha rp_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_Co de.
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(supp ose 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(suppos e 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(und er 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.comw rote in message
news:j4******** ******@TK2MSFTN GHUB02.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(supp ose 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(suppos e 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(und er 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
2272
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 environment installed, but fails to load on any Windows 2000 system with only the .NET Framework (tried .NET Framework SDK too) installed. Tried suggestions given in "Mixed DLL Loading Problem"
8
4503
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 problem and the potential for deadlocks. After pouring over the available information, and trying a few experiments, I am still left with a few questions and issues I hope someone out there can shed some light on.
8
1992
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 the usage of old style COM, my alternative is to expose my unmanaged interface through the CLI, to achieve that I have created a mixed mode DLL in which my unmanaged class are defined. When referencing the DLL just described in another mixed mode EXE...
1
1322
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 dll. When running on a development machine, everything works just fine. But when deploying on a production machine, there is an error: the mixed mode dll or one of its dependencies can not be found.
6
1125
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
1175
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 I have 3 options: 1) Re-implement it in C# - looks impossible: 1) I have to call several native methods with complex parameters like WSALookupServiceBegin
7
4797
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 compiles with /clr the instructions say that I need to change the switch for Debug information format from Program Database for Edit & Continue to disabled. At runtime I find that I am not able to set breakpoints in the managed code, nor trace...
6
1548
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. Microsoft's C compiler and Intel's Fortran compiler. The target machine and the development machines both have .Net 2 on them If I copy over the directory to a separate machine, the executable crashes/throws exceptions as the first non c# DLL is...
6
1359
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 that I converted from Website Project to Web Application Project. It is all VB except for one C# class. Since there is no App_Code folder with WAP, is there any way to still include the C# class in the same project or am I resigned to either...
0
8781
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8551
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8639
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7386
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5664
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4198
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4368
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2011
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1775
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.