访问DLL方法 [英] Access to dll methods

查看:186
本文介绍了访问DLL方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

结果
我准备这样做的一些功能对我的客户一些C#DLL。结果
的事情是,我也使用同一个DLL。结果
我怎么能使一些方法提供给他,对我所有可用的方法。结果
谢谢,结果


I prepared some C# dll for my customer that doing some functionality.
The thing is that I use also same dll.
How can I make some methods available to him and all methods available for me.
Thanks,

推荐答案

使用一个共享的代码库

简单地编译两个项目。其中包含了您提供给客户的DLL源,另一个包含所有源代码,您留给自己。

Simply compile two projects. One contains the source for the DLL you are providing to the customer, and the other contains all the source, which you keep for yourself.


  • 优点:他们没有看到有人要保留自己的来源,而不必设立任何形式的特殊托管 - 只是给他们的DLL

  • 缺点:你有做额外的工作来设置你的代码库是叉能。这可能是一个大的发展做投资这种重构的。

提供的Web服务

为客户访问被允许访问的代码提供一个Web服务。

Provide a web service for the customer to access the code that they are allowed to access.


  • 的优势:他们看到无源在所有

  • 缺点:根据不同的代码,它可能是一个大量的工作(获得安全先进的鼻烟)并且可能无法(获得的性能达到标准)。或者,它可能很容易,因为也许这些都不是大的担忧。您还可以设立专门的托管为此工作。

使用 InternalsVisibleTo 在共享DLL

Use the InternalsVisibleTo attribute in the shared DLL


  1. 标记要使用这些方法内部属性

  2. 代码签名您自己的代码,它使用的DLL

  3. 代码签名共享的DLL

  4. 添加 [汇编:InternalsVisibleTo] 来共享的DLL

  1. Mark those methods you want to use internal
  2. Code sign your own code that uses the DLL
  3. Code sign the shared DLL
  4. Add [assembly: InternalsVisibleTo] to the shared DLL

请参阅: http://msdn.microsoft.com/en -us /库/ system.runtime.compilerservices.internalsvisibletoattribute.aspx


  • 优点:这是一个非常简单的解决方案代码达

  • 缺点:客户将有机会获得完整的源代码,通过反射镜。您可以通过混淆你的代码,或建立一个授权协议,在法律上禁止他们逆向工程代码缓解这个。

这篇关于访问DLL方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆