Is there a possibility to include the current year via DateTime.Now.Year in the AssemblyInfo.cs-file?
I have tried:
[assembly: AssemblyCopyright("Copyright " + DateTime.Now.Year)]
But it seems the argument can only be a constant expression.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
As has been said, you cannot put values into attributes which are not constants.
DateTime.Nowis not a constant value and therefore cannot be used in an attribute.If you especially wanted this behaviour, you can add a script a pre-compile step which inserts the date into files.
Personally, given the rate at which the year changes, it would be time poorly spent creating an autonomous task to do this. I have numerous projects which have “2009” in their Assembly Info. I have a task in my list to complete in the new year, to run a Regex tool to find and replace all instances of “2009” with “2010” in the AssemblyInfo.cs files.
I would submit that this is a lot less work than integration into your build process.