ClickOnce不支持这一点(尽管我一直在要求它).
我很久以前收集了以下代码,但我没有时间尝试过.我把一个try/ catch它周围的情况下,它会导致一个问题.如果有效,请告诉我.;-)
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;
}
}
Run Code Online (Sandbox Code Playgroud)