Commit afaae6d0 afaae6d0714950f4856ad570f9ef21361b7b3e41 by Christian Gerdes

Better error handling in checkSetup()

1 parent 87a7ba19
......@@ -152,19 +152,32 @@ namespace WebTest.WebServive.Plugin
Directory.CreateDirectory(pluginPath);
Directory.CreateDirectory(assPath);
string messageLocNew = pluginPath + Path.GetFileName(messageLoc);
File.Copy(messageLoc, messageLocNew, true);
string runtimeLocNew = assPath + Path.GetFileName(runtimeLoc);
string exMsg = null;
try
{
File.Copy(messageLoc, messageLocNew, true);
File.Copy(runtimeLoc, runtimeLocNew, true);
}
catch (Exception e)
{
exMsg = e.Message;
}
if (exMsg == null)
{
//Update the registry
RegistryKey wrk = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\WebServicePlugin");
wrk.SetValue("INSTALLED", 1, RegistryValueKind.DWord);
RegistryKey wark = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\Microsoft\.NETFramework\AssemblyFolders\MyAssemblies");
wark.SetValue(null, assPath);
//Tell the user
VsShellUtilities.ShowMessageBox(this, "Recorder plugin copied to: " + pluginPath + "\n\nUser assemblies copied to: " + assPath, "Plugin files installed", OLEMSGICON.OLEMSGICON_INFO, OLEMSGBUTTON.OLEMSGBUTTON_OK, OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST);
}
else
{
VsShellUtilities.ShowMessageBox(this, "Warning, could not update/copy files: " + exMsg + "\n\nRecorder plugin path: " + pluginPath + "\n\nUser assemblies path: " + assPath + "\n\nCheck that there are no other instances of VS running or manually remove the above folders and try again.", "Plugin files NOT updated", OLEMSGICON.OLEMSGICON_WARNING, OLEMSGBUTTON.OLEMSGBUTTON_OK, OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST);
}
}
}
return installOK;
......