使用自定义设计器扩展 Visual Studio
如何为 C# 文件创建自定义 Visual Studio 2008 UI 设计器?
例如,当您双击解决方案资源管理器中的数据集时,会出现一个 UI 屏幕,允许您编辑该数据集,即使它是在 XML/代码中定义的(您可以右键单击并“查看代码”)。
通常,此代码以某种方式与用户代码分开,可以通过区域(“Windows 窗体设计器生成的代码”)、通过 codegen(对于 WPF XAML 文件为“.g.cs”),或通过某些其他方式(例如部分类)。
How do I create a custom Visual Studio 2008 UI designer for a C# file?
For example, when you double click on a DataSet in the Solution Explorer, a UI screen appears that allows you to edit the DataSet, even though it is defined in XML/code (which you can right click and "View Code").
Usually this code is separated from user code in some way, either by region ("Windows Forms Designer Generated Code"), by codegen (".g.cs" for WPF XAML files), or some other means like partial classes.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
有关 Visual Studio 可扩展性的一些提示,请参阅“Visual Studio 2010 插件编写文章/教程” ?”。 Visual Studio SDK 可能有您需要的信息。
For some hints on Visual Studio Extensibility, see "Visual Studio 2010 addin writing articles/tutorials?". The Visual Studio SDK may have the information you need.
那么,您必须购买 Visual Studio 扩展模型。您可以使用 EnvDTE 类做一些事情。然而它们相当有限,不足以做你想做的事。
下一站是基于 COM 的非托管可扩展性模型。这需要编写基于 IVxxxx 接口的非托管 COM 代码。可供第 3 方插件开发人员使用,例如制作 Resharper 的公司。你必须获得编写此类代码的许可证,微软不会相信你不会让他们的产品崩溃,除非你出示某种证明你知道自己在做什么。你得打电话,我想这叫做 VSIP 许可证。这是可能的,显然已经做到了。
请贵公司的法律顾问解决这些障碍。
Well, you'd have to buy into the Visual Studio extension model. There are things you can do with the EnvDTE class. They are however fairly limited, not good enough to do what you want to do.
The next stop is the unmanaged extensibility model, based on COM. That requires writing unmanaged COM code, based on IVxxxx interfaces. Available to 3rd party addon developers like the company that makes Resharper. You have to get a license to write that kind of code, Microsoft won't be convinced you won't crash their product until you show some kind of proof you know what you are doing. You'll have to call, I think it is called the VSIP licence. That's possible, obviously it has been done.
Ask your company's legal counsel to take care of those hurdles.