TheFrancisOne
TheFrancisOne

Reputation: 2737

C# How to build dll from net modules

In my project, I want to reuse some code for multiple binaries (.exe).

So, I decided to build a .dll from some sources and to include it in my .exe application thanks to csc.exe.

OK that works.

But now, I want to add a new level : I would like to build some net modules and then build my .dll which includes all net modules built before.

Is that possible ? How ?

Upvotes: 4

Views: 2616

Answers (3)

linuxuser27
linuxuser27

Reputation: 7353

This is possible. If you compile your projects all as .netmodules you can then link them into 1 single assembly. Instructions can be found here.

Upvotes: 1

Polesh
Polesh

Reputation: 11

/*for one file */
csc /target:module misource1.cs 

/*for multiple file */
csc /target:module misource1.cs misource2.cs misource3.cs 

Target is Module so keep it before the source file names

Upvotes: 1

Ben Voigt
Ben Voigt

Reputation: 283773

I think you are going to end up with a multiple file assembly if you use the C# compiler to do that.

But link.exe (which comes with Visual C++) should be able to produce a single file assembly from a bunch of .netmodule files.

Upvotes: 3

Related Questions