Reputation: 2687
I have a .NET application deployed via ClickOnce. The application icon shows fine on the start menu, task bar, etc., but not in the Add / Remove Programs in the control panel. What do I need to do to fix this?
Upvotes: 4
Views: 4184
Reputation: 11877
This isn't supported by ClickOnce (although I keep asking for it).
I collected the following code ages ago, but I have never had time to try it out. I'd put a try
/catch
around it in case it causes a problem. Let me know if it works. ;-)
RegistryKey myUninstallKey = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Uninstall");
string[] mySubKeyNames = myUninstallKey.GetSubKeyNames();
for (int i = 0; i < mySubKeyNames.Length; i++)
{
RegistryKey myKey = myUninstallKey.OpenSubKey(mySubKeyNames , true);
object myValue = myKey.GetValue("DisplayName");
if (myValue != null && (string)myValue == _ApplicationName)
{
myKey.SetValue("DisplayIcon", _ExecutablePath + @"\App.ico");
break;
}
}
Upvotes: 5