.NET“私有”应用
我创建一个 .NET (WPF) 应用程序,并将其编译为 .EXE。然后我创建第二个项目,并添加对已编译的 .exe 的引用,我可以看到所有类和表单,并可以将它们用于自动化等。
我想防止其他人将我编译的 .exe 用作 . dll,所以我将所有类更改为“Friend”而不是“Public”,但这不适用于 (wpf) 表单。每次我创建一个新班级时,我必须记住将其更改为“Friend”。
那么,是否有更好的解决方案来防止您的应用程序被用作 DLL?
更新:我知道.NET很容易反编译,并且访问修饰符可以被确定的“破解者”修改。但我只想让它变得更难一点,而不仅仅是添加参考。
也许我应该以不同的方式表述我的问题:如何使我的项目中的所有表单/类成为“朋友”,而不为每个项目指定它。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
最终你无能为力;反射可以让你绕过你所做的任何访问声明。
您可以混淆代码以使其更难以理解和使用,但它无法防止确定的入侵。
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.
最好的方法是在最终用户许可协议中添加一些内容,说明这是不允许的。
将类更改为友元并不会阻止某人使用它(如果他们确实想要的话)。他们所要做的就是修改 DLL,使类公开,而你的保护系统就失效了。
The best way to do this is to put something in the end-user license agreement saying that its not allowed.
Changing a class to friend will not prevent someone using it if they really want to. All they have to do is to modify the DLL to make the class public and your protection system has failed.