Search code examples
c#vb.netassemblyinfo

ProductName and CompanyName in C#


In VB.Net, I can retrieve my application's ProductName and CompanyName by using:

My.Application.Info.ProductName
My.Application.Info.CompanyName

How do I do the same thing in C#?


Solution

  • You can use Assembly and FileVersionInfo

    Assembly assembly = Assembly.GetExecutingAssembly();
    FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(assembly.Location);
    var companyName = fvi.CompanyName;
    var productName = fvi.ProductName;
    var productVersion = fvi.ProductVersion;