Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 .NET 插件框架中,我可以在主机端获取 AddIn dll 位置吗?
AddInToken 包含具有 dll 位置的 _addin 字段,但我无法获取它,因为它是私有的。
您可以使用的令牌上没有任何公开内容。您可以在从接口实现获取程序集的 AddInAdapter 中实现自己的方法。
因此,您必须激活令牌,然后在激活的对象上调用方法来确定装配位置。
例如,如果你在一个名为 _view 的对象中捕获了你的界面,你可以这样做:
System.Reflection.Assembly.GetAssembly(_view.GetType()).Location