#develop (short for SharpDevelop) is a free IDE for .NET programming languages.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

147 lines
3.6 KiB

<?xml version="1.0"?>
<Template originator = "Mike Krueger"
created = "02/01/2003"
lastModified = "16/06/2006">
<!-- Template Header -->
<TemplateConfiguration>
<Name>${res:Templates.Project.WindowsService.Name}</Name>
<Category>C#</Category>
<Subcategory>${res:Templates.File.Categories.WindowsApplications}</Subcategory>
<Icon>C#.Project.ServiceProject</Icon>
<LanguageName>C#</LanguageName>
<Description>${res:Templates.Project.WindowsService.Description}</Description>
</TemplateConfiguration>
<!-- Actions -->
<Actions>
<Open filename = "${ProjectName}.cs"/>
</Actions>
<!-- Template Content -->
<Combine name = "${ProjectName}" directory = ".">
<Options>
<StartupProject>${ProjectName}</StartupProject>
</Options>
<Project name = "${ProjectName}" directory = ".">
<Options />
<ProjectItems>
<Reference Include="System" />
<Reference Include="System.Configuration.Install" />
<Reference Include="System.Data" />
<Reference Include="System.ServiceProcess" />
<Reference Include="System.Xml" />
</ProjectItems>
<Files>
<File name="${ProjectName}.cs"><![CDATA[${StandardHeader.C#}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.ServiceProcess;
using System.Text;
namespace ${StandardNamespace}
{
public class ${ProjectName} : ServiceBase
{
public const string MyServiceName = "${ProjectName}";
public ${ProjectName}()
{
InitializeComponent();
}
private void InitializeComponent()
{
this.ServiceName = MyServiceName;
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose(bool disposing)
{
// TODO: Add cleanup code here (if required)
base.Dispose(disposing);
}
/// <summary>
/// Start this service.
/// </summary>
protected override void OnStart(string[] args)
{
// TODO: Add start code here (if required) to start your service.
}
/// <summary>
/// Stop this service.
/// </summary>
protected override void OnStop()
{
// TODO: Add tear-down code here (if required) to stop your service.
}
}
}
]]></File>
<File name="ProjectInstaller.cs"><![CDATA[${StandardHeader.C#}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration.Install;
using System.ServiceProcess;
namespace ${StandardNamespace}
{
[RunInstaller(true)]
public class ProjectInstaller : Installer
{
private ServiceProcessInstaller serviceProcessInstaller;
private ServiceInstaller serviceInstaller;
public ProjectInstaller()
{
serviceProcessInstaller = new ServiceProcessInstaller();
serviceInstaller = new ServiceInstaller();
// Here you can set properties on serviceProcessInstaller or register event handlers
serviceProcessInstaller.Account = ServiceAccount.LocalService;
serviceInstaller.ServiceName = ${ProjectName}.MyServiceName;
this.Installers.AddRange(new Installer[] { serviceProcessInstaller, serviceInstaller });
}
}
}
]]></File>
<File name="Program.cs"><![CDATA[${StandardHeader.C#}
using System;
using System.Collections.Generic;
using System.ServiceProcess;
using System.Text;
namespace ${ProjectName}
{
static class Program
{
/// <summary>
/// This method starts the service.
/// </summary>
static void Main()
{
// To run more than one service you have to add them here
ServiceBase.Run(new ServiceBase[] { new ${ProjectName}() });
}
}
}
]]></File>
<File name="AssemblyInfo.cs" src="DefaultAssemblyInfo.cs"/>
</Files>
</Project>
</Combine>
</Template>