The uninstaller found within the traditional installer (i.e. not the Inedo Hub) can be a bit tricky to debug... this is one of the many reasons behind building the Inedo Hub. We will likely only support the Hub next year.
If you're not getting any errors when you run the installer, the easiest way to diagnose the uninstaller is by following the code. It may be a missing registry key, permissions, etc.
You can also use the code to see exactly what needs to be uninstalled, should you need to do it manually.
public static void Uninstall(UninstallOptions options)
{
string servicePath;
string webPath;
try
{
GetRegistryInfo(out servicePath, out webPath);
}
catch
{
return;
}
string connectionString;
try
{
GetServiceInfo(servicePath, out connectionString);
}
catch
{
return;
}
StopService("INEDOOTTERSVC");
StopService("INEDOOTTERWEBSVC");
RunProcess(Path.Combine(servicePath, "Otter.Service.exe"), "uninstall");
RunProcess(Path.Combine(servicePath, "Otter.Service.exe"), "uninstallweb");
try { IIS.Current.DeleteWebSite("Otter"); }
catch { }
try { IIS.Current.DeleteAppPool("OtterAppPool"); }
catch { }
Thread.Sleep(5000);
DeleteDirectory(webPath);
DeleteDirectory(servicePath);
if (options.DeleteDatabase && !string.IsNullOrWhiteSpace(connectionString))
{
try
{
var connStringBuilder = new SqlConnectionStringBuilder(connectionString);
var dbName = connStringBuilder.InitialCatalog;
if (!string.IsNullOrWhiteSpace(dbName))
{
connStringBuilder.InitialCatalog = string.Empty;
using (var conn = new SqlConnection(connStringBuilder.ToString()))
{
conn.Open();
using (var cmd = new SqlCommand(string.Format("DROP DATABASE [{0}]", dbName), conn))
{
cmd.ExecuteNonQuery();
}
}
}
}
catch
{
}
}
Registry.LocalMachine.DeleteSubKeyTree(@"SOFTWARE\Inedo\Otter", false);
Registry.LocalMachine.DeleteSubKeyTree(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\InedoOtter", false);
DeleteDirectory(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonStartMenu), @"Inedo\Otter"));
try { Directory.Delete(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonStartMenu), "Inedo"), false); }
catch { }
FinishUninstall();
}
private static void GetRegistryInfo(out string servicePath, out string webPath)
{
using (var key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Inedo\Otter", false))
{
servicePath = (string)key.GetValue("ServicePath");
webPath = (string)key.GetValue("WebPath");
}
}
private static void GetServiceInfo(string servicePath, out string connectionString)
{
var xdoc = XDocument.Load(Path.Combine(servicePath, "Otter.Service.exe.config"));
connectionString = xdoc
.Element("configuration")
.Element("appSettings")
.Elements("add")
.Where(s => (string)s.Attribute("key") == "InedoLib.DbConnectionString")
.Select(s => (string)s.Attribute("value"))
.First();
}