Is it possible to statically pass code between projects in C #?

Is it possible in C # to share code between Visual Studio projects without having to distribute the DLL?

I support some software consisting of several Visual Studio C # projects, each building for a simple console executable. There is a lot of common code between the projects that I would like to check out. I believe that I can put code in a class library project, but I would prefer to avoid DLL references for distribution with each of the executable files.

Is there any way around this? I'm new to C #, so maybe I think about it anyway - are there any alternative suggestions?

+5
source share
9 answers

You can use ILMerge to combine the class library with exe.

http://research.microsoft.com/en-us/people/mbarnett/ilmerge.aspx

+4
source

Well, my personal preference would be to bite a bullet and distribute the DLL. This is the cleanest and most idiomatic option.

Other parameters:

  • You can add a link to an existing source file outside the project directory, if I remember correctly, but it will be somewhat strange.
  • You can use ilmerge to combine the class library into an executable as a step after assembly.
+3
source

visual studio - , "/ " "", " ".

, , , , , .

, , , - .

+3

ilmerge.

ilmerge /target:winexe /out:SelfContainedProgram.exe Program.exe ClassLibrary1.dll ClassLibrary2.dll

, . post post, .

+1

, , .

.

0

, ? , exe. exe , , exe A exe B, , A B.

0

, . . :

0

. VS.NET. . . VS.NET n , . .

0

DLL EXE Assembly.Load(byte[]).

0
source

All Articles