More nicer conflict management if the runtime is detected in old publicassemblies installs.
Showing
1 changed file
with
24 additions
and
5 deletions
... | @@ -109,6 +109,7 @@ namespace WebTest.WebServive.Plugin | ... | @@ -109,6 +109,7 @@ namespace WebTest.WebServive.Plugin |
109 | { | 109 | { |
110 | RegistryKey rk = Registry.CurrentUser.OpenSubKey("SOFTWARE\\WebServicePlugin"); | 110 | RegistryKey rk = Registry.CurrentUser.OpenSubKey("SOFTWARE\\WebServicePlugin"); |
111 | bool installOK = false; | 111 | bool installOK = false; |
112 | bool conflictInstall = false; | ||
112 | if(rk == null) | 113 | if(rk == null) |
113 | { | 114 | { |
114 | // Registry key not found, i.e. we did not install the dll's before | 115 | // Registry key not found, i.e. we did not install the dll's before |
... | @@ -121,10 +122,11 @@ namespace WebTest.WebServive.Plugin | ... | @@ -121,10 +122,11 @@ namespace WebTest.WebServive.Plugin |
121 | { | 122 | { |
122 | Int32 val = (Int32)regInstalled; | 123 | Int32 val = (Int32)regInstalled; |
123 | if (val == 1) installOK = true; | 124 | if (val == 1) installOK = true; |
124 | else installOK = false; | 125 | if (val == 2) conflictInstall = true; |
125 | } else | 126 | } else |
126 | { | 127 | { |
127 | installOK = false; | 128 | installOK = false; |
129 | conflictInstall = false; | ||
128 | } | 130 | } |
129 | } | 131 | } |
130 | 132 | ||
... | @@ -135,14 +137,15 @@ namespace WebTest.WebServive.Plugin | ... | @@ -135,14 +137,15 @@ namespace WebTest.WebServive.Plugin |
135 | string runtimeLoc = new Uri(typeof(WebService.Plugin.Runtime.WebServicePlugin).Assembly.CodeBase).LocalPath; | 137 | string runtimeLoc = new Uri(typeof(WebService.Plugin.Runtime.WebServicePlugin).Assembly.CodeBase).LocalPath; |
136 | 138 | ||
137 | // Check if the old runtime was found in PublicAssemblies (old version installed there) | 139 | // Check if the old runtime was found in PublicAssemblies (old version installed there) |
140 | bool detectedConflict = false; | ||
138 | if (runtimeLoc.Contains("PublicAssemblies") || runtimeLoc.Contains("MyAssemblies")) | 141 | if (runtimeLoc.Contains("PublicAssemblies") || runtimeLoc.Contains("MyAssemblies")) |
139 | { | 142 | { |
140 | // CONFLICT | 143 | // CONFLICT |
141 | 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, | 144 | 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, |
142 | "Conflicting previous version", OLEMSGICON.OLEMSGICON_CRITICAL, OLEMSGBUTTON.OLEMSGBUTTON_OK, OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST); | 145 | "Conflicting previous version", OLEMSGICON.OLEMSGICON_WARNING, OLEMSGBUTTON.OLEMSGBUTTON_OK, OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST); |
143 | return false; | 146 | detectedConflict = true; |
144 | } | 147 | } |
145 | else | 148 | if(conflictInstall == false) |
146 | { | 149 | { |
147 | // OK to proceed | 150 | // OK to proceed |
148 | // Copy message editor plugins and recorder plugin to users webtest dir | 151 | // Copy message editor plugins and recorder plugin to users webtest dir |
... | @@ -158,12 +161,28 @@ namespace WebTest.WebServive.Plugin | ... | @@ -158,12 +161,28 @@ namespace WebTest.WebServive.Plugin |
158 | 161 | ||
159 | //Update the registry | 162 | //Update the registry |
160 | RegistryKey wrk = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\WebServicePlugin"); | 163 | RegistryKey wrk = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\WebServicePlugin"); |
164 | if(detectedConflict) | ||
165 | wrk.SetValue("INSTALLED", 2, RegistryValueKind.DWord); | ||
166 | else | ||
161 | wrk.SetValue("INSTALLED", 1, RegistryValueKind.DWord); | 167 | wrk.SetValue("INSTALLED", 1, RegistryValueKind.DWord); |
162 | RegistryKey wark = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\Microsoft\.NETFramework\AssemblyFolders\MyAssemblies"); | 168 | RegistryKey wark = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\Microsoft\.NETFramework\AssemblyFolders\MyAssemblies"); |
163 | wark.SetValue(null, assPath); | 169 | wark.SetValue(null, assPath); |
164 | 170 | ||
165 | //Tell the user | 171 | //Tell the user |
166 | 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); | 172 | 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); |
173 | if(detectedConflict) | ||
174 | 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); | ||
175 | } else // conflictInstall is true | ||
176 | { | ||
177 | // Check if the conflict is fixed | ||
178 | if(detectedConflict == false) | ||
179 | { | ||
180 | // Seems to be fixed | ||
181 | //Update the registry | ||
182 | RegistryKey wrk = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\WebServicePlugin"); | ||
183 | wrk.SetValue("INSTALLED", 1, RegistryValueKind.DWord); | ||
184 | 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); | ||
185 | } | ||
167 | } | 186 | } |
168 | } | 187 | } |
169 | 188 | ... | ... |
-
Please register or sign in to post a comment