I prepared some C# dll for my customer that doing some functionality.
The thing is that I use also same dll.
How can I make some methods available to him and al
Use a shared code base
Simply compile two projects. One contains the source for the DLL you are providing to the customer, and the other contains all the source, which you keep for yourself.
Provide a web service
Provide a web service for the customer to access the code that they are allowed to access.
Use the InternalsVisibleTo
attribute in the shared DLL
internal
[assembly: InternalsVisibleTo]
to the shared DLLSee: http://msdn.microsoft.com/en-us/library/system.runtime.compilerservices.internalsvisibletoattribute.aspx
You could use the C# preprocessor directives like #define
to compile two versions of the library from the same code base.
Then ship one version to your customer, keep the other version for yourself.
You have to compile two versions of your assembly. The version you distribute to your cutomer needs to completely exclude the methods you don't want them to access, otherwise they'll be accessible through Reflection regardless of how you "hide" them.
(Assuming you don't want your assemblies to be signed)