clickonce 从哪里从 regedit 获取 DisplayName 中使用的值?

From where clickonce get the value used in DisplayName from regedit?

clickonce 从哪里得到寄存器 HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\XXXXXXXXDisplayName 中使用的值?我尝试在 VS 上更改应用程序标题和程序集名称(项目 -> 属性 -> 应用程序 -> 程序集信息),但这两者都没有改变 DisplayName 值中使用的名称。

我需要这个,因为我想避免 hard-code 我的应用程序名称出现在这段代码中,该代码改变了我的应用程序在 add/remove 程序

上的卸载图标
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[i], true);
    object myValue = myKey.GetValue("DisplayName");
    if (myValue != null && myValue.ToString() == applictionName) /* this must be the same used by clickonce to set DisplayName value  */
    {
        myKey.SetValue("DisplayIcon", iconSourcePath);
        break;
    }
}

From where clickonce get the value used in DisplayName from regedit?

要为 ClickOnce 应用程序设置 显示名称,您可以在 发布选项 在发布之前 Visual Studio 内。这会更新 ClickOnce 清单 - 有关 ClickOnce 应用程序的信息。此信息更为重要,并且基本上否决了您可能在 装配信息 .

中指定的任何详细信息

<项目>.Properties.Publish.Options

此外,对于 ClickOnce 应用程序,无需在 Windows 注册表 中乱搞。这样做可能会阻止自动更新。

object myValue = myKey.GetValue("UrlUpdateInfo");
if(myValue != null)
{
    string updateinfo = myValue.ToString();
    string updateLocation = ApplicationDeployment.CurrentDeployment.UpdateLocation.ToString();
    if (updateinfo==updateLocation)
    {
        myKey.SetValue("DisplayIcon", iconSourcePath);
        break;
    }
}