First, You should add reference to System.Configuration.Install
Install service:
string ServiceFileName = @"c:\myservice.exe";
System.Configuration.Install.AssemblyInstaller Installer = new System.Configuration.Install.AssemblyInstaller();
Installer.Path = ServiceFileName;
Installer.UseNewContext = true;
Installer.Install(null);
Installer.Commit(null);
Uninstall service:
string ServiceFileName = @"c:\myservice.exe";
System.Configuration.Install.AssemblyInstaller Installer = new System.Configuration.Install.AssemblyInstaller();
Installer.Path = ServiceFileName;
Installer.UseNewContext = true;
Installer.Uninstall(null);