Compile C#-Code and C++-Code into one class library

E

Ezmeralda

Hello,

currently, I have one class-library which is generated from a c++.net
class library project.
Into this project, I cannot include C# files.
On the other hand I have some C#-Code which accesses this class
library.
What I want to do is provide this C#-Code AND the C++.net-class-
library together
in one new class library. How can this be realized from a technical
point of view?
I don't want to have two class libraries!

Thanks!
 
D

Delicioustian

Hello~

I think there is no way to do this. Different programming language have
different
compiler.You cannot compile a CSharp code use a C++ compiler.
 
J

Jon Skeet [C# MVP]

currently, I have one class-library which is generated from a c++.net
class library project.
Into this project, I cannot include C# files.
On the other hand I have some C#-Code which accesses this class
library. What I want to do is provide this C#-Code AND the C++.net-class-
library together in one new class library. How can this be realized from a technical
point of view? I don't want to have two class libraries!

Have a look at http://research.microsoft.com/~mbarnett/ILMerge.aspx

Jon
 
N

Nicholas Paldino [.NET/C# MVP]

While Jon and Delicioustian have good ideas, there really is a simpler
way.

You can use the command line compilers to compile each project into a
netmodule (look at the command line compiler information for each respective
language for more info). Once you have those netmodules, you can use the
assembly linker (al.exe) to link the modules into an assembly.

You might even be able to modify the MSBUILD scripts to do this for you
at build time, but I haven't looked into that. It's feasible though.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top