Search code examples
.netreferenceprivatefriend

.NET 'Private' Application


I create a .NET (WPF) Application, and compile it to .EXE. Then I create a second project, and add a reference to the compiled .exe, I can see all the classes and forms, and can use them for automation, etc.

I want to prevent other people from using my compiled .exe as a .dll, so I changed all my classes to 'Friend' instead of 'Public', but this doesn't work for the (wpf) forms. And every time I create a new class, I must remember to change it to 'Friend'.

So, is there a better solution for preventing your app to be used as a DLL?

UPDATE: I am aware that .NET is easily decompilable, and that the access modifiers can be modified by a determined 'cracker'. But I only want to make it a little harder, than just adding a reference.

Maybe i should have stated my question differently: How can I make all forms/classes in my project 'Friend', without specifying it for every item.


Solution

  • There's little you can do, ultimately; reflection will let you get around any access declarations you make.

    You could obfuscate your code to make it more difficult to understand and therefore use, but it won't protect against a determined intrusion.