如何prevent他人使用我的.NET程序集?

编程入门 行业动态 更新时间:2024-10-10 06:18:13
本文介绍了如何prevent他人使用我的.NET程序集?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我应该的不可以要使用非指定可执行的其他任何应用程序的组件。请给我一些指示这样做的。

I have an assembly which should not be used by any application other than the designated executable. Please give me some instructions to do so.

推荐答案

您可以登录装配和使用相同的密钥的可执行文件,然后把支票在类的构造函数要保护:

You can sign the assembly and the executable with the same key and then put a check in the constructor of the classes you want to protect:

public class NotForAnyoneElse { public NotForAnyoneElse() { if (typeof(NotForAnyoneElse).Assembly.GetName().GetPublicKeyToken() != Assembly.GetEntryAssembly().GetName().GetPublicKeyToken()) { throw new SomeException(...); } } }

更多推荐

如何prevent他人使用我的.NET程序集?

本文发布于:2023-06-05 22:04:21,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/529892.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:程序   prevent   NET

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!