"Static" compilation in c#

  • Thread starter Thread starter Lars Olsson
  • Start date Start date
L

Lars Olsson

Let's say I'm developing a Class Library
Project in c#/VS that results in a dll, say A.dll.
Let's assume that I need to reference two other dll's
that I've developed, B.dll and C.dll.
How do I compile A.dll so that I don't have to distribute/expose
B.dll and C.dll to users of A.dll?
I just want to distribute A.dll, nothing else.
Thankful for any help
Lars
 
Lars,

If you have the source of the DLLs that you don't want to distribute, you
can add them to the DLL you want to distribute. When adding the existing
items, make sure to use Link instead of Open.

If you don't have the source, I'm not aware of a way around. I was thinking
about using the Assembly Linker (AL.EXE), but I never used it so I'm not
sure it will do the job. Check the documentation.

Gabriele
 
You could try linking as Gabrielle said, but at the end of the day what you
are trying to do here is fight against the way that assemblies work in .NET.

I assume the problem you are trying to solve is that you have some re-usable
code that you want to employ in A, and you don't really want to expose that
code to anything outside of your own projects.

The solution to me would appear to be not to use seperate class libraries
for B and C at all, but just to have these locked away in your source
control system or on a directory on your hard disk for you to include in
your new projects. By changing the scope of the classes inside these source
files you can ensure that they are not exposed to users of the A.dll
assembly.

A re-architecture of your object model is required I think ;)


--
Peter Wright
Author of ADO.NET Novice To Pro, from Apress Inc.


_____________________________
 
Back
Top