If you try to install the service without the ProjectInstaller, you will get an error message that says: No public installers with the RunInstallerAttribute.Yes attribute could be found. To add a ProjectInstaller to the project, right click on the ScheduledTaskService design surface and then click.
OK-Well I can't seem to get the service to show up in the services list.
Probably due to a failed installutil attempt
I believe I'm following the steps in the book line for line for creating a service so perhaps someone with more experience can tell me what is happening or not happening perhaps it's on the server that the problem resides?
here is my log:
Installing assembly 'c:watchforfile.exe'.
Affected parameters are:
assemblypath = c:watchforfile.exe
logfile = c:watchforfile.InstallLog
No public installers with the RunInstallerAttribute.Yes attribute could be found in the c:watchforfile.exe assembly.
Committing assembly 'c:watchforfile.exe'.
Affected parameters are:
assemblypath = c:watchforfile.exe
logfile = c:watchforfile.InstallLog
No public installers with the RunInstallerAttribute.Yes attribute could be found in the c:watchforfile.exe assembly.
Remove InstallState file because there are no installers.
'No public installers with the RunInstallerAttribute.Yes attribute could be found'
In general lot of people get a problem in common while deploying a Windows Service by utility like InstallUtil of .NET Framework, the reason for this may be your Windows Service is missing Service Installer pointing to it which is required and following program demonstrates adding a Service Installer as attribute along with your Windows Service code.
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Configuration.Install;
namespace SM.WinSrv
public partial class WindowsService : ServiceBase
public WindowsService()
this.ServiceName = 'SHANKARMANNE.WINDOWSSERVICE';
this.EventLog.Source = 'SHANKARMANNE.WINDOWSSERVICE';
// These Flags set whether or not to handle that specific
// type of event. Set to true if you need it, false otherwise.
this.CanHandleSessionChangeEvent = true;
this.CanShutdown = true;
if (!EventLog.SourceExists('SHANKARMANNE.WINDOWSSERVICE'))
EventLog.CreateEventSource('SHANKARMANNE.WINDOWSSERVICE', 'Application');
{
FileStream fs = new FileStream(@'D:SM_WindowsService.txt', FileMode.OpenOrCreate, FileAccess.Write);
StreamWriter m_streamWriter = new StreamWriter(fs);
m_streamWriter.BaseStream.Seek(0, SeekOrigin.End);
m_streamWriter.WriteLine('SHANKARMANNE.WINDOWSSERVICE: Service Started n');
m_streamWriter.Close();
{
FileStream fs = new FileStream(@'D:SM_WindowsService.txt', FileMode.OpenOrCreate, FileAccess.Write);
StreamWriter m_streamWriter = new StreamWriter(fs);
m_streamWriter.BaseStream.Seek(0, SeekOrigin.End);
m_streamWriter.WriteLine(' SHANKARMANNE.WINDOWSSERVICE: Service Stopped n'); m_streamWriter.Flush();
}
//This code is very important, a windows service needs service insatller at the time of deployment
public class WindowsServiceInstaller : Installer
///
/// Public Constructor for WindowsServiceInstaller.
///
{
ServiceProcessInstaller serviceProcessInstaller = new ServiceProcessInstaller();
ServiceInstaller serviceInstaller = new ServiceInstaller();
//# Service Account Information
serviceProcessInstaller.Account = ServiceAccount.LocalSystem;
serviceProcessInstaller.Password = null;
//# Service Information
serviceInstaller.DisplayName = 'SHANKARMANNE.WINDOWSSERVICE';
serviceInstaller.StartType = ServiceStartMode.Automatic;
// This must be identical to the WindowsService.ServiceBase name
serviceInstaller.ServiceName = 'SHANKARMANNE.WINDOWSSERVICE';
this.Installers.Add(serviceProcessInstaller);
}
For Deploying, I choose InstallUtil Utility and following is the format
To Install:
To Uninstall: