Attempt to create Uninstall reg key if not there

This commit is contained in:
Eric Reed 2013-04-06 12:40:04 -04:00
parent 2a9e59e623
commit d05f4d71d2
2 changed files with 15 additions and 6 deletions

View File

@ -475,13 +475,22 @@ namespace MediaBrowser.Installer
/// <param name="targetExe"></param> /// <param name="targetExe"></param>
private void CreateUninstaller(string uninstallPath, string targetExe) private void CreateUninstaller(string uninstallPath, string targetExe)
{ {
using (var parent = Registry.CurrentUser.OpenSubKey( var parent = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall", true);
@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall", true))
{ {
if (parent == null) if (parent == null)
{ {
MessageBox.Show("Uninstall registry key not found."); var rootParent = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion", true);
return; {
if (rootParent != null)
{
parent = rootParent.CreateSubKey("Uninstall");
if (parent == null)
{
MessageBox.Show("Unable to create Uninstall registry key. Program is still installed sucessfully.");
return;
}
}
}
} }
try try
{ {
@ -495,7 +504,7 @@ namespace MediaBrowser.Installer
if (key == null) if (key == null)
{ {
MessageBox.Show(String.Format("Unable to create uninstaller entry'{0}\\{1}'", @"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall", guidText)); MessageBox.Show(String.Format("Unable to create uninstaller entry'{0}\\{1}'. Program is still installed successfully.", @"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall", guidText));
return; return;
} }

View File

@ -31,7 +31,7 @@
<PublisherName>Media Browser Team</PublisherName> <PublisherName>Media Browser Team</PublisherName>
<SuiteName>Media Browser</SuiteName> <SuiteName>Media Browser</SuiteName>
<OpenBrowserOnPublish>false</OpenBrowserOnPublish> <OpenBrowserOnPublish>false</OpenBrowserOnPublish>
<ApplicationRevision>55</ApplicationRevision> <ApplicationRevision>57</ApplicationRevision>
<ApplicationVersion>0.1.1.%2a</ApplicationVersion> <ApplicationVersion>0.1.1.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust> <UseApplicationTrust>false</UseApplicationTrust>
<PublishWizardCompleted>true</PublishWizardCompleted> <PublishWizardCompleted>true</PublishWizardCompleted>