Click here to Skip to main content
15,890,512 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I use editconfig parameter
file_header_template
to add file header to my C# file. {fileName} update the file name in header. I wish to add the file creation date also.

What I have tried:

Using template variables like <year> or{year}, {date}, $date, $date$ . Without success.
have anyone the solution.
Thank you
Posted
Updated 1-Apr-22 1:26am

Try $time$. All template variables can be seen at Project and item template parameters - Visual Studio (Windows) | Microsoft Docs[^].
 
Share this answer
 
Comments
Maciej Los 1-Apr-22 11:29am    
5ed!
Richard MacCutchan 1-Apr-22 11:45am    
Thanks.
The CreationTime for a file is available by using the FileInfo class, but you need to do one of these two things:

0) Write a Vis Studio extension that can add a comment block with that info to each file. Instructions regarding development of a visual studio extension is beyond the scope of this question.

1) Write a program that you can add to/run from the Vis Studio "External Tools" menu. This simply requires you to write an application that prompts the user for a directory name where the files are located, as well as file extensions that need to be checked/modified. I would probably look at the FileInfo for each file, and when a file comes up with a CreationTime and LastWriteTime that are the same, automatically add the comment block. Otherwise, check the file to see if the comment block is already there, and if not, add it.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900