注册已安装的应用程序

时间:2015-01-31 14:59:23

标签: vb.net installation install

我为我的应用程序创建了一个小的自定义设置,我在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)

但它们都不起作用。应用程序将下载到程序文件夹中,但不会显示在CP中。我的应用程序具有管理权限,我在 WinForms,Visual Studio 2013 中工作。

谢谢,

FWhite

修改 尝试按建议插入DisplayIcon值,结果是这样,但在控制面板中仍然没有条目。我错过了什么吗? image http://i61.tinypic.com/24ys7z4.png

1 个答案:

答案 0 :(得分:1)

修改

您已将软件标记为系统组件("SystemComponent" = dword:00000001"),这意味着它应显示在“添加/删除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"
相关问题