I have a Netframework DLL project in Visual Studio and the DLL is compiled in Release mode and used in another project, how I can restrict to load or the use about the DLL by another person than could stolen my DLL and use in his/her project?
Asked
Active
Viewed 27 times
1 Answers
0
I found the solution with internal class and method:
Some class in My dll:
[assembly: InternalsVisibleTo("FriendAssembly")]
namespace MiLibrary
{
internal class Class1
{
internal static string GetName()
{
return "My Name";
}
}
}
Another Project in some class:
namespace MyApp
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
txbText.Text = MiLibrary.Class1.GetName();
}
}
}
Only "FriendAssembly" has access to Class1. "Another Project" must have the assembly name as "FriendAssembly" (Menu Project -> Properties of "Another Project" -> Application -> Assembly Name)
InternalsVisibleToAttribute Class
Related questions in Stackoverflow:

Ejrr1085
- 975
- 2
- 16
- 29