Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Current year in AssemblyInfo copyright

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.

like image 453
toni Avatar asked Dec 30 '09 12:12

toni


Video Answer


1 Answers

This can be automated, but you'll need to use a method which manipulates the AssemblyInfo.cs file pre-build.

Should you be doing this though?

A term of copyright doesn't restart when you rebuild your code. If the copyright is currently 2009 it should remain at 2009 regardless of the current year, unless you make significant* code changes in a later year.

*For the value of 'significant' you need to consult a lawyer, not a software developer.

like image 93
JoeG Avatar answered Sep 28 '22 06:09

JoeG