Better error handling in checkSetup()
Showing
1 changed file
with
23 additions
and
10 deletions
... | @@ -152,18 +152,31 @@ namespace WebTest.WebServive.Plugin | ... | @@ -152,18 +152,31 @@ namespace WebTest.WebServive.Plugin |
152 | Directory.CreateDirectory(pluginPath); | 152 | Directory.CreateDirectory(pluginPath); |
153 | Directory.CreateDirectory(assPath); | 153 | Directory.CreateDirectory(assPath); |
154 | string messageLocNew = pluginPath + Path.GetFileName(messageLoc); | 154 | string messageLocNew = pluginPath + Path.GetFileName(messageLoc); |
155 | File.Copy(messageLoc, messageLocNew, true); | ||
156 | string runtimeLocNew = assPath + Path.GetFileName(runtimeLoc); | 155 | string runtimeLocNew = assPath + Path.GetFileName(runtimeLoc); |
157 | File.Copy(runtimeLoc, runtimeLocNew, true); | 156 | string exMsg = null; |
157 | try | ||
158 | { | ||
159 | File.Copy(messageLoc, messageLocNew, true); | ||
160 | File.Copy(runtimeLoc, runtimeLocNew, true); | ||
161 | } | ||
162 | catch (Exception e) | ||
163 | { | ||
164 | exMsg = e.Message; | ||
165 | } | ||
158 | 166 | ||
159 | //Update the registry | 167 | if (exMsg == null) |
160 | RegistryKey wrk = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\WebServicePlugin"); | 168 | { |
161 | wrk.SetValue("INSTALLED", 1, RegistryValueKind.DWord); | 169 | //Update the registry |
162 | RegistryKey wark = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\Microsoft\.NETFramework\AssemblyFolders\MyAssemblies"); | 170 | RegistryKey wrk = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\WebServicePlugin"); |
163 | wark.SetValue(null, assPath); | 171 | wrk.SetValue("INSTALLED", 1, RegistryValueKind.DWord); |
164 | 172 | RegistryKey wark = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\Microsoft\.NETFramework\AssemblyFolders\MyAssemblies"); | |
165 | //Tell the user | 173 | wark.SetValue(null, assPath); |
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); | 174 | 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); |
175 | } | ||
176 | else | ||
177 | { | ||
178 | 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); | ||
179 | } | ||
167 | } | 180 | } |
168 | } | 181 | } |
169 | 182 | ... | ... |
-
Please register or sign in to post a comment