By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,806 Members | 1,465 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,806 IT Pros & Developers. It's quick & easy.

Mixing vb.net and C# in same project

P: n/a
Is it possible to add a vb.net source code module to a c#
project and if so how?

Thanks

Rudolf
Jul 19 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Hello Rudolf,

Thanks for posting in the group.

If you want to paste a VB code slice in C# file, I don't think that is
possible, since C# compiler won't compile VB code.

However, it is possible to use different languages in a single project. You
may need to write command line build file to build the project. In .NET
framework SDK, there is one sample on it. You could access it in C:\Program
Files\Microsoft Visual Studio
.NET\FrameworkSDK\Samples\Technologies\CrossDevLan guage.

This sample demonstrates the use different development languages in a
single project. This sample creates two assemblies. The first is a library
or DLL assembly that defines a simple base class written in managed
extensions for C++. The second assembly is an executable assembly that
defines three derived classes written in C#, VB, and IL (Intermediate
Language). These types derive from each other and ultimately from the base
class written in managed C++. Finally, the executable creates instances of
each of the derived types and calls a virtual method for each. The .NET
Framework is an environment where various developers can work together
seamlessly while developing in their language of choice.

Hope that helps.

Best regards,
Yanhong Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
!Content-Class: urn:content-classes:message
!From: "Rudolf" <Ru*****@hotmail.com>
!Sender: "Rudolf" <Ru*****@hotmail.com>
!Subject: Mixing vb.net and C# in same project
!Date: Thu, 4 Sep 2003 03:05:05 -0700
!Lines: 6
!Message-ID: <18****************************@phx.gbl>
!MIME-Version: 1.0
!Content-Type: text/plain;
! charset="iso-8859-1"
!Content-Transfer-Encoding: 7bit
!X-Newsreader: Microsoft CDO for Windows 2000
!X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
!Thread-Index: AcNyzAOGCuM5l40bQCaPevCQHfcbMw==
!Newsgroups: microsoft.public.dotnet.general
!Path: cpmsftngxa06.phx.gbl
!Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.general:107235
!NNTP-Posting-Host: TK2MSFTNGXA13 10.40.1.165
!X-Tomcat-NG: microsoft.public.dotnet.general
!
!Is it possible to add a vb.net source code module to a c#
!project and if so how?
!
!Thanks
!
!Rudolf
!

Jul 19 '05 #2

P: n/a
Thanks, I'll have a look at it

Rudolf
-----Original Message-----
Hello Rudolf,

Thanks for posting in the group.

If you want to paste a VB code slice in C# file, I don't think that ispossible, since C# compiler won't compile VB code.

However, it is possible to use different languages in a single project. Youmay need to write command line build file to build the project. In .NETframework SDK, there is one sample on it. You could access it in C:\ProgramFiles\Microsoft Visual Studio
.NET\FrameworkSDK\Samples\Technologies\CrossDevLa nguage.

This sample demonstrates the use different development languages in asingle project. This sample creates two assemblies. The first is a libraryor DLL assembly that defines a simple base class written in managedextensions for C++. The second assembly is an executable assembly thatdefines three derived classes written in C#, VB, and IL (IntermediateLanguage). These types derive from each other and ultimately from the baseclass written in managed C++. Finally, the executable creates instances ofeach of the derived types and calls a virtual method for each. The .NETFramework is an environment where various developers can work togetherseamlessly while developing in their language of choice.

Hope that helps.

Best regards,
Yanhong Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
!Content-Class: urn:content-classes:message
!From: "Rudolf" <Ru*****@hotmail.com>
!Sender: "Rudolf" <Ru*****@hotmail.com>
!Subject: Mixing vb.net and C# in same project
!Date: Thu, 4 Sep 2003 03:05:05 -0700
!Lines: 6
!Message-ID: <18****************************@phx.gbl>
!MIME-Version: 1.0
!Content-Type: text/plain;
! charset="iso-8859-1"
!Content-Transfer-Encoding: 7bit
!X-Newsreader: Microsoft CDO for Windows 2000
!X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
!Thread-Index: AcNyzAOGCuM5l40bQCaPevCQHfcbMw==
!Newsgroups: microsoft.public.dotnet.general
!Path: cpmsftngxa06.phx.gbl
!Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.general:107235!NNTP-Posting-Host: TK2MSFTNGXA13 10.40.1.165
!X-Tomcat-NG: microsoft.public.dotnet.general
!
!Is it possible to add a vb.net source code module to a c#!project and if so how?
!
!Thanks
!
!Rudolf
!

.

Jul 19 '05 #3

P: n/a
Hello Rudolf,

You are welcome.

Thanks for participating the community.

Best regards,
Yanhong Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
!Content-Class: urn:content-classes:message
!From: "Rudolf" <Ru*****@Hotmail.com>
!Sender: "Rudolf" <Ru*****@Hotmail.com>
!References: <18****************************@phx.gbl>
<PY**************@cpmsftngxa06.phx.gbl>
!Subject: RE: Mixing vb.net and C# in same project
!Date: Thu, 4 Sep 2003 06:00:54 -0700
!Lines: 85
!Message-ID: <0d****************************@phx.gbl>
!MIME-Version: 1.0
!Content-Type: text/plain;
! charset="iso-8859-1"
!Content-Transfer-Encoding: 7bit
!X-Newsreader: Microsoft CDO for Windows 2000
!X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
!Thread-Index: AcNy5JNwVQFkpkT1Rd+pEkhBA8mf7w==
!Newsgroups: microsoft.public.dotnet.general
!Path: cpmsftngxa06.phx.gbl
!Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.general:107256
!NNTP-Posting-Host: TK2MSFTNGXA11 10.40.1.163
!X-Tomcat-NG: microsoft.public.dotnet.general
!
!Thanks, I'll have a look at it
!
!Rudolf
!
!>-----Original Message-----
!>Hello Rudolf,
!>
!>Thanks for posting in the group.
!>
!>If you want to paste a VB code slice in C# file, I don't
!think that is
!>possible, since C# compiler won't compile VB code.
!>
!>However, it is possible to use different languages in a
!single project. You
!>may need to write command line build file to build the
!project. In .NET
!>framework SDK, there is one sample on it. You could
!access it in C:\Program
!>Files\Microsoft Visual Studio
!>.NET\FrameworkSDK\Samples\Technologies\CrossDevL anguage.
!>
!>This sample demonstrates the use different development
!languages in a
!>single project. This sample creates two assemblies. The
!first is a library
!>or DLL assembly that defines a simple base class written
!in managed
!>extensions for C++. The second assembly is an executable
!assembly that
!>defines three derived classes written in C#, VB, and IL
!(Intermediate
!>Language). These types derive from each other and
!ultimately from the base
!>class written in managed C++. Finally, the executable
!creates instances of
!>each of the derived types and calls a virtual method for
!each. The .NET
!>Framework is an environment where various developers can
!work together
!>seamlessly while developing in their language of choice.
!>
!>Hope that helps.
!>
!>Best regards,
!>Yanhong Huang
!>Microsoft Online Partner Support
!>
!>Get Secure! - www.microsoft.com/security
!>This posting is provided "AS IS" with no warranties, and
!confers no rights.
!>
!>--------------------
!>!Content-Class: urn:content-classes:message
!>!From: "Rudolf" <Ru*****@hotmail.com>
!>!Sender: "Rudolf" <Ru*****@hotmail.com>
!>!Subject: Mixing vb.net and C# in same project
!>!Date: Thu, 4 Sep 2003 03:05:05 -0700
!>!Lines: 6
!>!Message-ID: <18****************************@phx.gbl>
!>!MIME-Version: 1.0
!>!Content-Type: text/plain;
!>! charset="iso-8859-1"
!>!Content-Transfer-Encoding: 7bit
!>!X-Newsreader: Microsoft CDO for Windows 2000
!>!X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
!>!Thread-Index: AcNyzAOGCuM5l40bQCaPevCQHfcbMw==
!>!Newsgroups: microsoft.public.dotnet.general
!>!Path: cpmsftngxa06.phx.gbl
!>!Xref: cpmsftngxa06.phx.gbl
!microsoft.public.dotnet.general:107235
!>!NNTP-Posting-Host: TK2MSFTNGXA13 10.40.1.165
!>!X-Tomcat-NG: microsoft.public.dotnet.general
!>!
!>!Is it possible to add a vb.net source code module to a
!c#
!>!project and if so how?
!>!
!>!Thanks
!>!
!>!Rudolf
!>!
!>
!>.
!>
!

Jul 19 '05 #4

P: 1
In the App_Code subfolder you'll need to create 2 new subfolders, one for your C# classes and another for your VB.NET classes. After that you'll need to specify these 2 folders in the web.config in the <compilation> section like this:

<system.web>

<compilation debug="true">

<codeSubDirectories>

<add directoryName="CSharp"/>

<add directoryName="VB"/>

</codeSubDirectories>

</compilation>



</system.web>
Jul 1 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.