更新时间:2023-02-25 17:33:56
在Visual Studio 2013 RTM有一个添加完全自定义的架子工的支持。你只能做以下自定义:
In Visual Studio 2013 RTM there is no support for adding completely custom scaffolders. You can only do the following customizations:
在Visual Studio团队正在重新启用自定义棚架支持在Visual Studio的更新版本。
The Visual Studio team is working on re-enabling custom scaffolder support in a future update of Visual Studio.
要添加的今天自定义视图棚架:
To add a custom view scaffolder today:
codeTemplates
MvcView
或 MvcViewWithoutModel
根据您的自定义视图模板是否是强类型的视图< TEMPLATENAME方式><郎> .t4
其中< TEMPLATENAME>
是要在MVC视图棚架的下拉列表和&LT展现出来什么;郎>
是 CS
或 VB
。CodeTemplates
MvcView
or MvcViewWithoutModel
depending on whether your custom view template is a strongly-typed view<templatename>.<lang>.t4
where the <templatename>
is whatever you want to show up in the MVC View scaffolder's drop down list and <lang>
is either cs
or vb
.要开始,你可以从VS2013的默认列表复制任何现有的棚架和定制。您可以从这里得到内置架子工:
To get started you can copy any existing scaffolder from VS2013's default list and customize it. You can get the built-in scaffolders from here:
C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\Microsoft\Web\Mvc\Scaffolding\Templates\MvcView
C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\Microsoft\Web\Mvc\Scaffolding\Templates\MvcViewWithoutModel
如果您使用相同的名称与现有棚架那么它将覆盖内置的棚架,从另一个名为棚架甚至当。例如,MVC控制器棚架将使用在你的项目中被覆盖的视图棚架。
If you use the same name as an existing scaffolder then it will override the built-in scaffolder, even when called from another scaffolder. For example, the MVC controller scaffolder will use an overridden view scaffolder that is in your project.
2014年4月22日更新
现在的Visual Studio 2013更新2可那previews,就可以写出完全自定义的脚手架。
Now that previews of Visual Studio 2013 Update 2 are available, it is possible to write completely custom scaffolders.
看看这篇博客文章,通过如何编写自定义的棚架散步:为Visual Studio 创建自定义棚架
Check out this blog post that walks through how to write a custom scaffolder: Creating a Custom Scaffolder for Visual Studio