Say I've written a .Net dll and want to distribute it with my application. How can I prevent any user with the savvy to install a copy of VS from adding a reference to this dll to their own applications?
There is no way to prevent a user from adding a reference. It's a passive action from the part of your DLL and there is nothing you can do to prevent it from occuring.
What you can do though, is make adding a reference a non-worthwhile operation. For instance, if all types in the DLL were internal or private, it take more than simply adding a reference for users to use the types in the DLL. Furthmore, obfuscating the DLL would make it even harder.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With