Where can I set the file version comments..?
We can get it by
FileVersionInfo fv =
System.Diagnostics.FileVersionInfo.GetVersionInfo(
Assembly.GetExecutingAssembly().Location);
var comment = fv.Comments;
Then how can I set it so that I can show the same somewhere..
For .NET Assemblies you can set the File Version Comments using the AssemblyDescriptionAttribute, which you usually put in the AssemblyInfo.cs file in your project when using Visual Studio.
[assembly: AssemblyDescription("The assembly does xxx by yyy")]
For other types of executables the file version is set using a resource in the file.
The different assembly level File Version attributes maps as follows:
Nowadays in .Net 6
you can set comments in*.csproj
<Description>My Comment</Description>
And get
public static string GetComments()
{
var fileName = Assembly.GetEntryAssembly()?.Location;
if (fileName == null) return String.Empty;
var versionInfo = FileVersionInfo.GetVersionInfo(fileName);
return versionInfo?.Comments ?? String.Empty;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With