views:

94

answers:

2

I would like to include the current timestamp as part of my Visual Studio Item Template (the timestamp of when the file is created by the user). Is this possible?

+1  A: 

You can cause code to be executed when a template is expanded by implementing a wizard. The wizard need not have a user interface, but can populate a dictionary of name/value pairs. The values can then be substituted into the template.

Look in the Visual Studio SDK documentation for the topic named "How to: Use Wizards with Project Templates". I believe you can also use a wizard in an item template.

Also, take a look at the Guidance Automation Toolkit, which provides a declarative way to create wizards, among many other things.

John Saunders
A: 

It's really simple. There are several built-in replacement parameters that you can use. For a timestamp, include $time$ in the template. It will be replaced by the current date and time in the format DD/MM/YYYY HH:MM:SS.

Check this excellent guide: Create Reusable Project And Item Templates For Your Development Team

Tor Haugen
Thanks. I didn't know that $time$ was one of the builty-in values.
John Saunders