Commit 7bd13658 7bd136585263edcc4de22fd27afcef3392645159 by Christian Gerdes

More nicer conflict management if the runtime is detected in old publicassemblies installs.

1 parent 10052676
......@@ -109,6 +109,7 @@ namespace WebTest.WebServive.Plugin
{
RegistryKey rk = Registry.CurrentUser.OpenSubKey("SOFTWARE\\WebServicePlugin");
bool installOK = false;
bool conflictInstall = false;
if(rk == null)
{
// Registry key not found, i.e. we did not install the dll's before
......@@ -121,10 +122,11 @@ namespace WebTest.WebServive.Plugin
{
Int32 val = (Int32)regInstalled;
if (val == 1) installOK = true;
else installOK = false;
if (val == 2) conflictInstall = true;
} else
{
installOK = false;
conflictInstall = false;
}
}
......@@ -135,14 +137,15 @@ namespace WebTest.WebServive.Plugin
string runtimeLoc = new Uri(typeof(WebService.Plugin.Runtime.WebServicePlugin).Assembly.CodeBase).LocalPath;
// Check if the old runtime was found in PublicAssemblies (old version installed there)
bool detectedConflict = false;
if (runtimeLoc.Contains("PublicAssemblies") || runtimeLoc.Contains("MyAssemblies"))
{
// CONFLICT
VsShellUtilities.ShowMessageBox(this, "Previous version of the runtime dll was found in the PublicAssemblies or MyAssemblies folder. This version will conflict with this new version of the plugin. Please remove it and restart Visual Studio.\n\n Path to the DLL: " + runtimeLoc,
"Conflicting previous version", OLEMSGICON.OLEMSGICON_CRITICAL, OLEMSGBUTTON.OLEMSGBUTTON_OK, OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST);
return false;
VsShellUtilities.ShowMessageBox(this, "Previous version of the runtime dll was found in the PublicAssemblies or MyAssemblies folder. This version will conflict with this new version of the plugin. If you do not want that, remove the DLL and restart Visual Studio.\n\n Path to the DLL: " + runtimeLoc,
"Conflicting previous version", OLEMSGICON.OLEMSGICON_WARNING, OLEMSGBUTTON.OLEMSGBUTTON_OK, OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST);
detectedConflict = true;
}
else
if(conflictInstall == false)
{
// OK to proceed
// Copy message editor plugins and recorder plugin to users webtest dir
......@@ -158,12 +161,28 @@ namespace WebTest.WebServive.Plugin
//Update the registry
RegistryKey wrk = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\WebServicePlugin");
wrk.SetValue("INSTALLED", 1, RegistryValueKind.DWord);
if(detectedConflict)
wrk.SetValue("INSTALLED", 2, RegistryValueKind.DWord);
else
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);
if(detectedConflict)
VsShellUtilities.ShowMessageBox(this, "Since there was a conflicting version of the runtime dll, the installed dll will not be used by loadtests until you remove it from the generall path. A message regarding this will be displayed each time you open VS as a reminder.","Conflict Warning", OLEMSGICON.OLEMSGICON_WARNING, OLEMSGBUTTON.OLEMSGBUTTON_OK, OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST);
} else // conflictInstall is true
{
// Check if the conflict is fixed
if(detectedConflict == false)
{
// Seems to be fixed
//Update the registry
RegistryKey wrk = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\WebServicePlugin");
wrk.SetValue("INSTALLED", 1, RegistryValueKind.DWord);
VsShellUtilities.ShowMessageBox(this, "Previous conflicting DLL has been removed. We will now stop nagging about this.", "Plugin files installed OK", OLEMSGICON.OLEMSGICON_INFO, OLEMSGBUTTON.OLEMSGBUTTON_OK, OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST);
}
}
}
......