库设计时验证 [英] Design-Time validation of library
问题描述
我有我想许可和分发库。
I have a library that I would like to license and distribute.
我知道如何许可运行时类/库。我已经做了好几次,真的。我知道如何授权用户的控制。我也做了好几次。
I know how to license a class/library for runtime. I've done that several times, actually. I know how to license a user control. I've also done that several times.
什么是难住我了是如何授权的库(即没有拖/放的用户控件或组件)仅用于开发。你怎么许可证设计时库?
What's got me stumped is how to license a library (that has no drag/drop user control or component) for development only. How do you license a library for design-time?
有什么想法/提示吗?
推荐答案
我终于找到了答案。这个人是不是因为我认为这将是为明显。
I finally found the answer. This one isn't as apparent as I thought it would be.
而不是寻找DesignTime或运行属性,你需要看到,如果一个调试器附加。
Instead of looking for DesignTime or RunTime attributes, you need to see if a debugger is attached.
在构造函数中删除这个(与你的类的属性),而你去和运行!
Drop this in the constructor (with the appropriate attributes on your class), and you're off and running!!
if (System.Diagnostics.Debugger.IsAttached)
{
License L = LicenseManager.Validate(typeof(MyControl), this);
}
我希望这可以帮助别人有同样的问题!
I hope this helps someone else with the same issue!!
- 杰里
这篇关于库设计时验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!