Better error handling in checkSetup()
Showing
1 changed file
with
16 additions
and
3 deletions
| ... | @@ -152,19 +152,32 @@ namespace WebTest.WebServive.Plugin | ... | @@ -152,19 +152,32 @@ 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); |
| 156 | string exMsg = null; | ||
| 157 | try | ||
| 158 | { | ||
| 159 | File.Copy(messageLoc, messageLocNew, true); | ||
| 157 | File.Copy(runtimeLoc, runtimeLocNew, true); | 160 | File.Copy(runtimeLoc, runtimeLocNew, true); |
| 161 | } | ||
| 162 | catch (Exception e) | ||
| 163 | { | ||
| 164 | exMsg = e.Message; | ||
| 165 | } | ||
| 158 | 166 | ||
| 167 | if (exMsg == null) | ||
| 168 | { | ||
| 159 | //Update the registry | 169 | //Update the registry |
| 160 | RegistryKey wrk = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\WebServicePlugin"); | 170 | RegistryKey wrk = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\WebServicePlugin"); |
| 161 | wrk.SetValue("INSTALLED", 1, RegistryValueKind.DWord); | 171 | wrk.SetValue("INSTALLED", 1, RegistryValueKind.DWord); |
| 162 | RegistryKey wark = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\Microsoft\.NETFramework\AssemblyFolders\MyAssemblies"); | 172 | RegistryKey wark = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\Microsoft\.NETFramework\AssemblyFolders\MyAssemblies"); |
| 163 | wark.SetValue(null, assPath); | 173 | wark.SetValue(null, assPath); |
| 164 | |||
| 165 | //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); | 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); |
| 167 | } | 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 | } | ||
| 180 | } | ||
| 168 | } | 181 | } |
| 169 | 182 | ||
| 170 | return installOK; | 183 | return installOK; | ... | ... |
-
Please register or sign in to post a comment