2

Last year I implemented this solution https://stackoverflow.com/a/19314275/1166898 to automatically update the copyright notice when the project is built, but I found out this year that the template isn't run unless it's changed, and it warns me that it's not trusted before running it.

enter image description here

How do I

  1. run this file every build without it needing to be changed
  2. trust just this file without automatically trusting every other .tt file

If it's not possible, what's a better way of updating the copyright year automatically?

CJ Dennis
  • 4,226
  • 2
  • 40
  • 69

1 Answers1

0

There's a surprisingly easy way using Property Functions in your .csproj;

<PropertyGroup>
    <Copyright>My Company $([System.DateTime]::Now.Year)</Copyright>
</PropertyGroup>

So long as you haven't set <GenerateAssemblyInfo>false</GenerateAssemblyInfo>, then the usual set of assembly attributes will be generated for you from MSBuild properties. See the documentation for more info.

Jeremy Lakeman
  • 9,515
  • 25
  • 29