Visual Studio 2010的代码生成插件编写教程

5
我想在Visual Studio 2010中添加一个编辑器,类似于Entity Framework的编辑器。也就是说,您可以获得一个可视化设计器,将其自己的配置保存到自己的文件中,然后从该文件生成代码。
因此,这两个方面涉及特定文件扩展名的可视化表示以及代码生成(或者应该在编辑文件时生成代码,还是仅在构建时生成?)
我已经搜索了一些资源,但没有找到如何做这些特定事情的资源(尤其是代码生成部分)。如果有任何指向正确方向的资源,将不胜感激。
3个回答

5

微软的可视化和建模SDK - 面向特定领域的语言:

http://msdn.microsoft.com/zh-cn/library/bb126259.aspx

引用自该网站:

Using Visual Studio Visualization and Modeling SDK (VMSDK), you can create powerful model-based development tools that you can integrate into Visual Studio. As an example, the UML tools are created using VMSDK. In the same manner, you can create one or more model definitions and integrate them into a set of tools.

At the heart of VMSDK is the definition of a model that you create to represent concepts in your business area. You can surround the model with a variety of tools, such as a diagrammatic view, the ability to generate code and other artifacts, commands for transforming the model, and the ability to interact with code and other objects in Visual Studio. As you develop the model, you can combine it with other models and tools to form a powerful toolset that is centered on your development.

VMSDK lets you develop a model quickly in the form of a domain-specific language (DSL). You begin by using a specialized editor to define a schema or abstract syntax together with a graphical notation. From this definition, VMSDK generates:

A model implementation with a strongly-typed API that runs in a transaction-based store.

A tree-based explorer.

A graphical editor in which users can view the model or parts of it that you define.

Serialization methods that save your models in readable XML.

Facilities for generating program code and other artifacts using text templating.

You can customize and extend all of these features. Your extensions are integrated in such a way that you can still update the DSL definition and re-generate the features without losing your extensions.


1
这个领域特定框架是专门为此而设计的,为什么会被投反对票? - Danny Varod
它看起来很有前途,我只是在观看Tech Ed Video,看看它是否能够满足我的需求。 - Cornelius
1
对你的回答点赞,我真不明白为什么会有人给你踩一下。 - Nock


0

我对VS插件开发一无所知,那你为什么要回答呢? - jgauffin
我的回答不仅仅是关于插件的。 - Anton Semenov

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接