Kyle
Kyle

Reputation: 1181

Code file templates in Visual Studio 2010

Xcode has a feature where each type of file has a template that is filled out when that type of file is created. By default, those files are located at /Developer/Library/Xcode/Templates/File Templates.

These files are used to give whatever default code you want, such as a common file header, even including things like the copyright year. I've gotten quite used to the functionality in Xcode, but I find myself missing it in Visual Studio. With VS I have to manually copy-paste the header and modify it myself for each file. Is there a way to get Visual Studio to automatically populate files (such as cpp's or .h's) with code?

EDIT: I'm trying to do this with C++.

Upvotes: 1

Views: 303

Answers (1)

Jon Skeet
Jon Skeet

Reputation: 1500515

Yes, you can use templates with macros etc in Visual Studio as well. MSDN has an article on it, and there are various blog posts on the topic too. I know they work for C# and VB - I expect C++ works in the same sort of way, but you'll need to check of course. (Apologies if this isn't the case.)

Unfortunately last time I looked it required expanding and then compressing zip files in a way that seemed a little unnecessary, but it should be doable.

Upvotes: 1

Related Questions