472,127 Members | 2,047 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,127 software developers and data experts.

Hi! Having Problem while placing vb and cs files together

If i place vb and cs class files together in App_Code in asp.net 2.0 i
get error that i can't place as they us a different language which is
not allowed as they have to be complied together.

Is there any solution???

Jul 22 '06 #1
7 1408
I am not aware of any solution for creating a secondary App_code
folder. I think the solution would be to translate the smallest
(/easiest) code file :-(

shwetu wrote:
If i place vb and cs class files together in App_Code in asp.net 2.0 i
get error that i can't place as they us a different language which is
not allowed as they have to be complied together.

Is there any solution???
Jul 22 '06 #2
The single App_Code directory can only contain files of the same language.

However, 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 )


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/
===================================
"Jacob" <ja***@reimers.dkwrote in message
news:11**********************@i3g2000cwc.googlegro ups.com...
>I am not aware of any solution for creating a secondary App_code
folder. I think the solution would be to translate the smallest
(/easiest) code file :-(

shwetu wrote:
>If i place vb and cs class files together in App_Code in asp.net 2.0 i
get error that i can't place as they us a different language which is
not allowed as they have to be complied together.

Is there any solution???

Jul 22 '06 #3
Hi!
Thx Juan T. Llibre!!
The solution worked !!!!!

Juan T. Llibre wrote:
The single App_Code directory can only contain files of the same language.

However, 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 )


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/
===================================
"Jacob" <ja***@reimers.dkwrote in message
news:11**********************@i3g2000cwc.googlegro ups.com...
I am not aware of any solution for creating a secondary App_code
folder. I think the solution would be to translate the smallest
(/easiest) code file :-(

shwetu wrote:
If i place vb and cs class files together in App_Code in asp.net 2.0 i
get error that i can't place as they us a different language which is
not allowed as they have to be complied together.

Is there any solution???
Jul 29 '06 #4
Glad to know you're up and running, shwetu!

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/
===================================
"shwetu" <sh*************@gmail.comwrote in message
news:11*********************@i3g2000cwc.googlegrou ps.com...
Hi!
Thx Juan T. Llibre!!
The solution worked !!!!!

Juan T. Llibre wrote:
The single App_Code directory can only contain files of the same language.

However, 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 )


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/
===================================
"Jacob" <ja***@reimers.dkwrote in message
news:11**********************@i3g2000cwc.googlegro ups.com...
I am not aware of any solution for creating a secondary App_code
folder. I think the solution would be to translate the smallest
(/easiest) code file :-(

shwetu wrote:
If i place vb and cs class files together in App_Code in asp.net 2.0 i
get error that i can't place as they us a different language which is
not allowed as they have to be complied together.

Is there any solution???

Jul 29 '06 #5
"Juan T. Llibre" <no***********@nowhere.comwrote in message
news:OR**************@TK2MSFTNGP03.phx.gbl...

Juan,
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 )
Does this also work for code files placed in other folders? E.g.

<webroot>
<App_Code>
<App_Code\VB>
MyClass.vb
<App_Code\CS>
MyClass.cs
<home>
default.aspx
default.aspx.vb
<welcome>
default.aspx
default.aspx.cs

Mark
Jul 29 '06 #6
re:
Does this also work for code files placed in other folders? E.g.
<home>
default.aspx
default.aspx.vb
<welcome>
default.aspx
default.aspx.cs
No, Mark.

You can't place *.vb and .cs files in different directories
of your app and expect them to compile [ wouldn't that be nice... :-) ]

The VB/CS code subdirectories are *only* for class files.
The code in each of the dirs declared in web.config will be compiled to a separate assembly.

An alternate way to handle this would be to compile your different-language source code
to an assembly which you place in the /bin directory, and not upload the source files at all.

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/
===================================
"Mark Rae" <ma**@markNOSPAMrae.comwrote in message news:OD**************@TK2MSFTNGP02.phx.gbl...
"Juan T. Llibre" <no***********@nowhere.comwrote in message
news:OR**************@TK2MSFTNGP03.phx.gbl...

Juan,
>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 )

Does this also work for code files placed in other folders? E.g.

<webroot>
<App_Code>
<App_Code\VB>
MyClass.vb
<App_Code\CS>
MyClass.cs
<home>
default.aspx
default.aspx.vb
<welcome>
default.aspx
default.aspx.cs

Mark

Jul 29 '06 #7
"Juan T. Llibre" <no***********@nowhere.comwrote in message
news:OT**************@TK2MSFTNGP02.phx.gbl...
re:
>Does this also work for code files placed in other folders? E.g.
<home>
default.aspx
default.aspx.vb
<welcome>
default.aspx
default.aspx.cs

No, Mark.

You can't place *.vb and .cs files in different directories
of your app and expect them to compile [ wouldn't that be nice... :-) ]
Hurrah! That's precisely what I was hoping you'd say! Long story, but thank
God for that!
The VB/CS code subdirectories are *only* for class files.
The code in each of the dirs declared in web.config will be compiled to a
separate assembly.
Makes sense, now you come to mention it...
An alternate way to handle this would be to compile your
different-language source code
to an assembly which you place in the /bin directory, and not upload the
source files at all.
Or, even better, just stick to C#... :-)

<ducks and covers>
Jul 29 '06 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

16 posts views Thread by matthurne | last post: by
1 post views Thread by Christopher M. Lusardi | last post: by
reply views Thread by just.starting | last post: by
14 posts views Thread by Jan Schmidt | last post: by
2 posts views Thread by Brian A. Cline | last post: by

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.