Mixing and matching VB and C# in vs.net 2005

J

jason

I've been working with C# for over a year now without touching vb.net
code. I had a few light years of vb.net before that. No real vb6 or
windows form experience.

Suddenly, I have an assignment where I've been asked to create a few
new pages on an exsisting website. The website is written in vb.net
with vb.net codebehind and classes.

My employer says I can use C# for new stuff If I want.

Is it really possible and what's the cleanest way to do this?

Also, at the old shop where I was at I was the only .NET deployer I
would deploy from TEST to PROD by doing an xcopy of the website
directory. Is this the way most shops deploy from TEST to PROD. And, if
they don't have VSS, can more than one developer develop and change the
same object in the same project at the same time and then deploy
(possibly at the same time)? How do must small shops coordinate
multiple developers working on the same projects/pages?

Finally, I was just playing with VB.NET, and i noticed the code snippet
feature seems to be much more robust or at least easier to read than
what's available in C#, with things like create a folder.. is this
true? and is there a c# comparable for things like:

My.Computer.FileSystem.CreateDirectory(`)


Thanks
 
J

Juan T. Llibre

you can add subdirectories to the App_Code directory
in order to process multiple languages under the App_Code directory.

In order to do this, you need to register each subdirectory in the application's Web.config.

<configuration>
<system.web>
<compilation debug="false">
<codeSubDirectories>
<add directoryName="VB"/>
<add directoryName="CS"/>
</codeSubDirectories>
</compilation>
</system.web>
</configuration>

Then, simply creating the App_Code\VB and App_Code\CS directories,
and placing your VB and CS files in each, will allow you to use both languages in your app.

This only works in ASP.NET 2.0! ( and is quite easy to implement )

Caveat: this works only for "helper classes".
You cannot place code-behind pages in the individual language directories.

However, it *does* allow you to mix different-language source files in the same app.

An alternative would be to compile your different-language source files
from the command-line, and placing the compiled assemblies in /bin.
 
J

jason

That's going to be rough.

I did some testing and see the problem is mainly with VS.NET and trying
to compile the two different languages under the same project. I can
try and set up codebehind as C# but vs.net has problems with that.

I read that can have of course have two different projects under the
solution explorer one vb and C#, but it seems kinda messy with two
different web.config files, set of refrences and directories etc...

One thing I can't figure out under VS.NET, I can add a new (different
language) website into my solution and have both visible.. but how do
Open an exsisting project into the current solution without it closing
the one I have open. And what if I want to have 4 projects under my
solution always open and want to close vs.net and open that set of
solutions.

Seems to me mixing and matching is going to be really messy.

If I decide I want to do all new development for a website in C#, and I
create a new website under the old website named c.. ala
g:\web\mysite\c\ and start adding pages there knowing that there might
be menus that cross in and out of that c directory.. would that be a
terrible choice? Also wondering if master and content pages can cross
languages?

This must be a big issue with so many java developers moving into C#
without even looking at vb.net. I wonder if most shops just covert over
cold turkey? I think MS should make it even more seemless somehow,
allow cross language in the same project and even in the same page.
 
M

Michael D. Ober

I am working on integrating a new site for our company. Our legacy system
interface is entirely in VB (6 and 2005 versions) and the site designers
used C#. Works like a champ as long as you ensure the public interfaces are
CLR compliant. Mixing languages in the same project isn't as simple, but
multiple projects in the same solution can all be easily handled.

Mike Ober.



That's going to be rough.

I did some testing and see the problem is mainly with VS.NET and trying
to compile the two different languages under the same project. I can
try and set up codebehind as C# but vs.net has problems with that.

I read that can have of course have two different projects under the
solution explorer one vb and C#, but it seems kinda messy with two
different web.config files, set of refrences and directories etc...

One thing I can't figure out under VS.NET, I can add a new (different
language) website into my solution and have both visible.. but how do
Open an exsisting project into the current solution without it closing
the one I have open. And what if I want to have 4 projects under my
solution always open and want to close vs.net and open that set of
solutions.

Seems to me mixing and matching is going to be really messy.

If I decide I want to do all new development for a website in C#, and I
create a new website under the old website named c.. ala
g:\web\mysite\c\ and start adding pages there knowing that there might
be menus that cross in and out of that c directory.. would that be a
terrible choice? Also wondering if master and content pages can cross
languages?

This must be a big issue with so many java developers moving into C#
without even looking at vb.net. I wonder if most shops just covert over
cold turkey? I think MS should make it even more seemless somehow,
allow cross language in the same project and even in the same page.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,754
Messages
2,569,526
Members
44,997
Latest member
mileyka

Latest Threads

Top