将应用程序注册为已安装

Register application as installed

我正在为我的应用程序创建一些自定义设置,我正在 VB.NET 中编写它。我没有使用安装程序创建器(如 InnoSetup 或其他),因为我需要从云端下载应用程序文件,老实说,我不喜欢默认安装程序的布局。

我的问题是:如何注册一个应用程序以便它显示在控制面板中?我尝试在 HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall{FA82A5DD-E444-430F-9D60-10D20F5A8E4B} 中创建一个子项,但没有出现任何内容。我的代码是这样的:

Dim Key As RegistryKey = Registry.LocalMachine.CreateSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{FA82A5DD-E444-430F-9D60-10D20F5A8E4B}")
Key.SetValue("AuthorizedCDFPrefix", "", RegistryValueKind.String)
Key.SetValue("Comments", "", RegistryValueKind.String)
Key.SetValue("Contact", "http://www.hssc.com/jump", RegistryValueKind.String)
Key.SetValue("DisplayName", "Jump 2015 Edition", RegistryValueKind.String)
Key.SetValue("DisplayVersion", "5.0.0.0", RegistryValueKind.String)
Key.SetValue("EstimatedSize", 10485760, RegistryValueKind.DWord)
Key.SetValue("HelpLink", "http://www.hssc.com/jump")
Key.SetValue("HelpTelephone", "", RegistryValueKind.String)
Key.SetValue("InstallDate", String.Format("{0:yyyyddMM}", Now.Date), RegistryValueKind.String)
Key.SetValue("InstallLocation", "", RegistryValueKind.String)
Key.SetValue("InstallSource", "", RegistryValueKind.String)
Key.SetValue("Language", 1044, RegistryValueKind.DWord)
Key.SetValue("ModifyPath", "MsiExec.exe /I{FA82A5DD-E444-430F-9D60-10D20F5A8E4B}", RegistryValueKind.String)
Key.SetValue("Publisher", "HSSC", RegistryValueKind.String)
Key.SetValue("Readme", "", RegistryValueKind.String)
Key.SetValue("Size", "", RegistryValueKind.String)
Key.SetValue("SystemComponent", 1, RegistryValueKind.DWord)
Key.SetValue("UninstallString", "MsiExec.exe /I{FA82A5DD-E444-430F-9D60-10D20F5A8E4B}")
Key.SetValue("URLInfoAbout", "http://www.hssc.com/jump", RegistryValueKind.String)
Key.SetValue("URLUpdateInfo", "", RegistryValueKind.String)
Key.SetValue("VersionMajor", 5, RegistryValueKind.DWord)
Key.SetValue("VersionMinor", 0, RegistryValueKind.DWord)

我也试过这个:

Dim KeyApp As RegistryKey = Registry.LocalMachine.CreateSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\jump.exe")
KeyApp.SetValue("", Path.Combine(InstallLocation, "jump.exe"), RegistryValueKind.String)
KeyApp.SetValue("Path", InstallLocation, RegistryValueKind.String)

但其中 none 有效。该应用程序已下载到程序文件夹中,但未显示在 CP 中。我的应用程序具有管理权限,我在 WinForms,Visual Studio 2013.

中工作

谢谢,

F白

编辑 尝试按照建议插入 DisplayIcon 值,结果是这样,但控制面板中仍然没有条目。我错过了什么吗?

编辑

您已将您的软件标记为系统组件 ("SystemComponent" = dword:00000001"),这意味着它应该显示在“Add/Remove Windows 组件”中。因此,只需将 SystemComponent 设置为 0 或简单地删除它。应该这样做。 :)


您缺少“DisplayIcon”值。如果需要,这是来自 WinRar 子项的示例:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\WinRar archiver]
"DisplayName"="WinRar 5.10 (64-bit)"
"DisplayVersion"="5.10.0"
"VersionMajor"=dword:00000005
"VersionMinor"=dword:0000000a
"UninstallString"="G:\Program Files\WinRAR\uninstall.exe"
"DisplayIcon"="G:\Program Files\WinRAR\WinRAR.exe"
"InstallLocation"="G:\Program Files\WinRAR\"
"NoModify"=dword:00000001
"NoRepair"=dword:00000001
"Language"=dword:00000000
"Publisher"="win.rar GmbH"