Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using (var inst = new AssemblyInstaller(typeof(MyNamespace.Program).Assembly, new string[] { })) {
- IDictionary state = new Hashtable();
- inst.UseNewContext = true;
- try {
- if (uninstall) {
- inst.Uninstall(state);
- } else {
- inst.Install(state);
- inst.Commit(state);
- }
- } catch {
- try {
- inst.Rollback(state);
- } catch { }
- throw;
- }
- }
- using (var sc = new ServiceController("the service's name"))
- {
- sc.Start();
- sc.WaitForStatus(ServiceControllerStatus.Running, TimeSpan.FromSeconds(20));
- }
- ServiceInstaller
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement