开发者

How do you make a t4 template installable in visual studio?

开发者 https://www.devze.com 2023-02-05 01:06 出处:网络
I have written a couple of t4 templates for EF4, I want to get other developers to use them, so id like to make them installable in VS so that people cna jsut add them to their projects.

I have written a couple of t4 templates for EF4, I want to get other developers to use them, so id like to make them installable in VS so that people cna jsut add them to their projects.

I have no idea how to do t开发者_开发百科his. Any idea about where i should start reading? Idid a quick google and had no luck.

Thanks.


An alternative is to create a VS item template.

There is an export template wizard accessed vie the File/ExportTemplate menu. After you've exported a T4 template, you'll probably want to manually edit the resultign item, as it doesn't handle the generated file well by default.

You'll have your template from the wizard as a zip file. Unzip this and remove the generated file. Then edit the Foo.vstemplate file and remove the line referencing the generated file. Finally zip the files up again.

Your colleagues can just drop this zip file into their user templates directory: C:\Users\\Documents\Visual Studio 2010\Templates\ItemTemplates


For external sharing, your best bet is probably to create a nuget package.

Have a look at this link:

http://haacked.com/archive/2011/01/12/uploading-packages-to-the-nuget-gallery.aspx

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号