Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Mixing and matching VB and C# in vs.net 2005

Reply
Thread Tools

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

 
 
jason@cyberpine.com
Guest
Posts: n/a
 
      09-28-2006
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

 
Reply With Quote
 
 
 
 
Juan T. Llibre
Guest
Posts: n/a
 
      09-28-2006
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.



Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espaņol : http://asp.net.do/foros/
===================================

<(E-Mail Removed)> wrote in message news:(E-Mail Removed) ps.com...
> 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 existing 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
>




 
Reply With Quote
 
 
 
 
jason@cyberpine.com
Guest
Posts: n/a
 
      09-29-2006
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.


Juan T. Llibre wrote:
> 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.
>
>
>
> Juan T. Llibre, asp.net MVP
> aspnetfaq.com : http://www.aspnetfaq.com/
> asp.net faq : http://asp.net.do/faq/
> foros de asp.net, en espaņol : http://asp.net.do/foros/
> ===================================
>
> <(E-Mail Removed)> wrote in message news:(E-Mail Removed) ps.com...
> > 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 existing 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
> >


 
Reply With Quote
 
Michael D. Ober
Guest
Posts: n/a
 
      09-30-2006
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.



<(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ups.com...
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.


Juan T. Llibre wrote:
> 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.
>
>
>
> Juan T. Llibre, asp.net MVP
> aspnetfaq.com : http://www.aspnetfaq.com/
> asp.net faq : http://asp.net.do/faq/
> foros de asp.net, en espaņol : http://asp.net.do/foros/
> ===================================
>
> <(E-Mail Removed)> wrote in message

news:(E-Mail Removed) ps.com...
> > 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 existing 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
> >





 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
MSVC++ 2005 Express Ed. build error when mixing boost lexical_castand shared_ptr hsmit.home@gmail.com C++ 8 11-21-2007 09:30 AM
Help with Pattern matching. Matching multiple lines from while reading from a file. Bobby Chamness Perl Misc 2 05-03-2007 06:02 PM
"Certifications for Visual Studio 2005 and SQL Server 2005 will be available in early 2006" DST MCSD 8 10-28-2005 02:50 AM
New Exams for SQL Server 2005 and Visual Studio 2005 gemeaux | tt Microsoft Certification 1 10-25-2004 06:59 PM
Pattern matching : not matching problem Marc Bissonnette Perl Misc 9 01-13-2004 05:52 PM



Advertisments