开发者

Application icon doesn't show in control panel 'Add/Remove Programs'

开发者 https://www.devze.com 2023-01-04 09:10 出处:网络
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 Progr开发者_StackOverflowams in the control panel.What

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 Progr开发者_StackOverflowams in the control panel. What do I need to do to fix this?


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;
    }
}
0

精彩评论

暂无评论...
验证码 换一张
取 消