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

Mixing languages in one assembly

P: n/a
BK
I have a .NET project named FormattedOuput with output type set to
Class Library. In it, I have a source file named ExcelOutput.Vb. This
class produces an Excel object and manipulates it based on some input I
provide. It works fine and has been fully tested.

Meanwhile, another programmer was writing a source file named
RTFOutput.Cs, a C Sharpt program that does similiar work for RTF file
output. He has fully tested his source and it works as we need it.

I *thought* that all I would need to do is add his Cs file to my
project, recompile, and life would be grand. However, intellisense
only shows me the Vb class. So while FormattedOutput.ExcelOutput is
valid, FormattedOutput.RTFOutput is not. We've mixed and matched
different source files in this Solution before, but never mixed
languages in the same assembly. Can this be done?

Apr 5 '06 #1
Share this Question
Share on Google+
7 Replies


P: n/a

BK wrote:
I have a .NET project named FormattedOuput with output type set to
Class Library. In it, I have a source file named ExcelOutput.Vb. This
class produces an Excel object and manipulates it based on some input I
provide. It works fine and has been fully tested.

Meanwhile, another programmer was writing a source file named
RTFOutput.Cs, a C Sharpt program that does similiar work for RTF file
output. He has fully tested his source and it works as we need it.

I *thought* that all I would need to do is add his Cs file to my
project, recompile, and life would be grand. However, intellisense
only shows me the Vb class. So while FormattedOutput.ExcelOutput is
valid, FormattedOutput.RTFOutput is not. We've mixed and matched
different source files in this Solution before, but never mixed
languages in the same assembly. Can this be done?


It can be... It just takes manual intervention (I think VS2005 can
handle this - but, I haven't tried it there so I'm not positive). In
other words, you will have to compile and link the code using the
commandline compiler/linker programs.

It would probably be easier to put the C# code in it's own dll and then
reference it from your VB project....

--
Tom Shelton [MVP]

Apr 5 '06 #2

P: n/a
AFAIK :
- you can't mix languages inside the same project.
- if I remember this is a VS.NET limitation. A workaround could be to
compile (using the command line compiler) one of the file to a "module"
(doesn't have anything to do with vb modules, see this rather as a .LIB
file) and then you could be able to compile (wiht the command line compiler)
the other file adding the previous "module"

I actually tried to find this in the doc and saw :
http://msdn.microsoft.com/library/de...ToAssembly.asp

Please let us know (never tried, would like to know if it works).

--
Patrice

"BK" <bk******@hotmail.com> a écrit dans le message de news:
11*********************@i40g2000cwc.googlegroups.c om...
I have a .NET project named FormattedOuput with output type set to
Class Library. In it, I have a source file named ExcelOutput.Vb. This
class produces an Excel object and manipulates it based on some input I
provide. It works fine and has been fully tested.

Meanwhile, another programmer was writing a source file named
RTFOutput.Cs, a C Sharpt program that does similiar work for RTF file
output. He has fully tested his source and it works as we need it.

I *thought* that all I would need to do is add his Cs file to my
project, recompile, and life would be grand. However, intellisense
only shows me the Vb class. So while FormattedOutput.ExcelOutput is
valid, FormattedOutput.RTFOutput is not. We've mixed and matched
different source files in this Solution before, but never mixed
languages in the same assembly. Can this be done?

Apr 5 '06 #3

P: n/a

"BK" <bk******@hotmail.com> wrote in message
news:11*********************@i40g2000cwc.googlegro ups.com...
I have a .NET project named FormattedOuput with output type set to
Class Library. In it, I have a source file named ExcelOutput.Vb. This
class produces an Excel object and manipulates it based on some input I
provide. It works fine and has been fully tested.

Meanwhile, another programmer was writing a source file named
RTFOutput.Cs, a C Sharpt program that does similiar work for RTF file
output. He has fully tested his source and it works as we need it.

I *thought* that all I would need to do is add his Cs file to my
project, recompile, and life would be grand. However, intellisense
only shows me the Vb class. So while FormattedOutput.ExcelOutput is
valid, FormattedOutput.RTFOutput is not. We've mixed and matched
different source files in this Solution before, but never mixed
languages in the same assembly. Can this be done?


No. One assembly, one language. You will either have to convert to a
single language or create two different projects.

Mythran

Apr 5 '06 #4

P: n/a
Not using the VS IDE, you need to do it by hand using the SDK command-line
compilers / linkers.

You can only mix languages in the same project using the IDE when doing VS
2005 web projects.

--

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio
You can code, design and document much faster:
http://www.mztools.com
"BK" <bk******@hotmail.com> escribió en el mensaje
news:11*********************@i40g2000cwc.googlegro ups.com...
I have a .NET project named FormattedOuput with output type set to
Class Library. In it, I have a source file named ExcelOutput.Vb. This
class produces an Excel object and manipulates it based on some input I
provide. It works fine and has been fully tested.

Meanwhile, another programmer was writing a source file named
RTFOutput.Cs, a C Sharpt program that does similiar work for RTF file
output. He has fully tested his source and it works as we need it.

I *thought* that all I would need to do is add his Cs file to my
project, recompile, and life would be grand. However, intellisense
only shows me the Vb class. So while FormattedOutput.ExcelOutput is
valid, FormattedOutput.RTFOutput is not. We've mixed and matched
different source files in this Solution before, but never mixed
languages in the same assembly. Can this be done?

Apr 5 '06 #5

P: n/a

"Mythran" <ki********@hotmail.comREMOVETRAIL> wrote in message
news:OA**************@TK2MSFTNGP05.phx.gbl...

"BK" <bk******@hotmail.com> wrote in message
news:11*********************@i40g2000cwc.googlegro ups.com...
I have a .NET project named FormattedOuput with output type set to
Class Library. In it, I have a source file named ExcelOutput.Vb. This
class produces an Excel object and manipulates it based on some input I
provide. It works fine and has been fully tested.

Meanwhile, another programmer was writing a source file named
RTFOutput.Cs, a C Sharpt program that does similiar work for RTF file
output. He has fully tested his source and it works as we need it.

I *thought* that all I would need to do is add his Cs file to my
project, recompile, and life would be grand. However, intellisense
only shows me the Vb class. So while FormattedOutput.ExcelOutput is
valid, FormattedOutput.RTFOutput is not. We've mixed and matched
different source files in this Solution before, but never mixed
languages in the same assembly. Can this be done?


No. One assembly, one language. You will either have to convert to a
single language or create two different projects.

Mythran


I stand corrected.

Mythran

Apr 5 '06 #6

P: n/a
BK
What I'm seeing from my research, it can be done but it must be done
from command line calls. It's not the end of the world if I can't do
it, I'll probably just rewrite my part in C# as an excercise. This
other developer and I get along real well here and commonly split
things up. He prefers C#, I prefer Vb. Thanks for all the replies!

Bill

Apr 5 '06 #7

P: n/a

BK wrote:
What I'm seeing from my research, it can be done but it must be done
from command line calls. It's not the end of the world if I can't do
it, I'll probably just rewrite my part in C# as an excercise. This
other developer and I get along real well here and commonly split
things up. He prefers C#, I prefer Vb. Thanks for all the replies!

Bill


You can still share your code without duplicating effort... Just write
them in class libraries/user controls and distribute the dll's. You
can have different projects in the same solution that use different
languages - the problems arise when you want to use different languages
in the same project.

--
Tom Shelton [MVP]

Apr 6 '06 #8

This discussion thread is closed

Replies have been disabled for this discussion.