Compile C# and VB.Net code together?

  • Thread starter Thread starter Özden Irmak
  • Start date Start date
Ö

Özden Irmak

Hello,

I have a Windows Forms control written in VB.Net which I want to include it
to my C# project...

For a special reason,instead of distributing the dll with my ap, I want it
to compile and link it into my C# code...Is it possible?

Thanks in advance...

Özden
 
Özden Irmak said:
I have a Windows Forms control written in VB.Net which I want to include it
to my C# project...

For a special reason,instead of distributing the dll with my ap, I want it
to compile and link it into my C# code...Is it possible?

From the command line, it is - you can compile each of your bits of
codes into a module, and then link the modules into a single assembly.
However, there's no way of doing this from VS.NET.
 
Hello,

I didn't use command line compiler so far and don't know anything about it?

Any sample can you provide or a resource in web I can check?

Regards,

Özden

Özden Irmak said:
I have a Windows Forms control written in VB.Net which I want to include it
to my C# project...

For a special reason,instead of distributing the dll with my ap, I want it
to compile and link it into my C# code...Is it possible?

From the command line, it is - you can compile each of your bits of
codes into a module, and then link the modules into a single assembly.
However, there's no way of doing this from VS.NET.
 
Özden Irmak said:
I didn't use command line compiler so far and don't know anything about it?

Any sample can you provide or a resource in web I can check?

You'd need to use csc to compile the C# code and vbc to compile the
VB.NET code. In both cases, use /t:module to produce modules. Then use
al to link them together, eg:

csc /t:module File1.cs
vbc /t:module File2.cs

al /t:exe /main:Foo.Main File1.netmodule File2.netmodule

(Untested, but I believe it'll work.)
 
Back
Top