views:

174

answers:

4

How can a .net class library project and resulting dll be protected so it cant be referenced by other applications (.net projects) except those projects in my own solution?

+1  A: 

Forgive my ignorance, but if they're all class libraries, what does the code do? Isn't the purpose of having a dll so that the code can be referenced.

In any case if you mark everything internal it won't be able to be accessed outside its own library

Glenn Slaven
+1  A: 

I think what deanbates is saying is that he is trying to find a way to keep a DLL public within his own application and private for everything else

Jon Limjap
+7  A: 

I think you can't forbid other applications to reference you library.
You can make library's classes internal and provide access to them via InternalVisibleTo attribute but it won't save you from reflection.

aku
+2  A: 

Yep, aku is right. In reality if you want certain types & methods to only be accessible to one application, you're better off compiling it all into one exe & marking those types all internal. You can then obfuscate the code to avoid the issue with reflection (see here)

Glenn Slaven