I currently have an app displaying the build number in its title window. That\'s well and good except it means nothing to most of the users, who want to know if they have t
For .NET Core projects, I adapted Postlagerkarte's answer to update the assembly Copyright field with the build date.
The following can be added directly to the first PropertyGroup in the csproj:
Copyright © $([System.DateTime]::UtcNow.Year) Travis Troyer ($([System.DateTime]::UtcNow.ToString("s")))
Or paste the inner expression directly into the Copyright field in the Package section of the project properties in Visual Studio:
Copyright © $([System.DateTime]::UtcNow.Year) Travis Troyer ($([System.DateTime]::UtcNow.ToString("s")))
This can be a little confusing, because Visual Studio will evaluate the expression and display the current value in the window, but it will also update the project file appropriately behind the scenes.
You can plop the element above into a Directory.Build.props file in your solution root, and have it automatically applied to all projects within the directory, assuming each project does not supply its own Copyright value.
Copyright © $([System.DateTime]::UtcNow.Year) Travis Troyer ($([System.DateTime]::UtcNow.ToString("s")))
Directory.Build.props: Customize your build
The example expression will give you a copyright like this:
Copyright © 2018 Travis Troyer (2018-05-30T14:46:23)
You can view the copyright information from the file properties in Windows, or grab it at runtime:
var version = FileVersionInfo.GetVersionInfo(Assembly.GetEntryAssembly().Location);
Console.WriteLine(version.LegalCopyright);