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

Discussion in 'ASP .Net' started by jason@cyberpine.com, Sep 28, 2006.

  1. Guest

    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
    , Sep 28, 2006
    #1
    1. Advertising

  2. 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/
    ===================================

    <> wrote in message news:...
    > 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
    >
    Juan T. Llibre, Sep 28, 2006
    #2
    1. Advertising

  3. Guest

    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/
    > ===================================
    >
    > <> wrote in message news:...
    > > 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
    > >
    , Sep 29, 2006
    #3
  4. 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.



    <> wrote in message
    news:...
    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/
    > ===================================
    >
    > <> wrote in message

    news:...
    > > 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
    > >
    Michael D. Ober, Sep 30, 2006
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Juan T. Llibre
    Replies:
    0
    Views:
    441
    Juan T. Llibre
    Jun 7, 2005
  2. Sql Agentman
    Replies:
    0
    Views:
    639
    Sql Agentman
    Jan 19, 2006
  3. Replies:
    8
    Views:
    575
    James Kanze
    Nov 21, 2007
  4. Marc Bissonnette

    Pattern matching : not matching problem

    Marc Bissonnette, Jan 8, 2004, in forum: Perl Misc
    Replies:
    9
    Views:
    220
    Marc Bissonnette
    Jan 13, 2004
  5. Bobby Chamness
    Replies:
    2
    Views:
    213
    Xicheng Jia
    May 3, 2007
Loading...

Share This Page