C# How to correctly set assembly title for Windows

2019-08-12 12:04发布

问题:

I've set the title & assembly info of my C# Winforms executable as follow:

[assembly: AssemblyTitle("Widgets Galore")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Widgets Inc")]
[assembly: AssemblyProduct("Widgets Galore")]
[assembly: AssemblyCopyright("Copyright © Widgets Inc 2012")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

...

MainForm.Text = "Widgets Galore by Widgets Incorporated";

...

// Compiles to: widgets.app.exe

In Windows 7 Task Manager, it correctly shows the process as the main form title:

"Widgets Galore by Widgets Incorporated"

However in Windows 8 Task Manager, it incorrectly shows the executable name, with a sub item:

"widgets.app"
    |--"Widgets Galore by Widgets Incorporated".

I see plenty of other applications listed with a friendly name in the Windows 8 Task Manager, and would like to see my app do the same.

How can I force W8 to do a friendly name for my app?

-Brendan

回答1:

Through trial and error I found that Windows 8 Task Manager shows the exe name regardless of [AssemblyTitle], IF your file is not digitally signed. I assume this is a security measure. Solution: digitally sign.