How to forbid a .NET DLL class library to be referenced

How can I forbid dll class library to be referenced in other solutions?


You could look into adding a StrongNameIdentityPermission to your class library that matches the strong name of the program you do want to be able to use it with.

Alternatively, you could explore using InternalsVisibleToAttribute, although it may require some design changes in your library code. This should work as long as neither assembly is signed, or both are signed with a strong name. The argument specified on the attribute should match the public key and the name of the assembly that you want to be able to access its internal members.

But really, this will only stop someone who isn't trying very hard to use your library. They won't be able to add a reference, but it doesn't prevent someone from bypassing it through Reflection or disassembling your code. There are always ways around almost any security measure that you implement.

Need Your Help

Debugging issue in Visual Studio 2008

.net visual-studio-2008

I have written my code on my desktop machine in

Image uploaded to Facebook but not shown on page

ios facebook facebook-graph-api titanium image-uploading

I am trying to upload an image to a specific album on Facebook page through Graph api call from ipad app. Everything is working correctly and the response from Facebook returns success with the id of

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.