home *** CD-ROM | disk | FTP | other *** search
/ Chip 2005 February / CMCD0205.ISO / Software / Freeware / Programare / Sharp / SharpDevelop_1.0.3.1761_Setup.exe / Service.xpt < prev    next >
Extensible Markup Language  |  2004-07-05  |  4KB  |  135 lines

  1. <?xml version="1.0"?>
  2. <Template originator   = "Markus Palme"
  3.           created      = "24/11/2002"
  4.           lastModified = "02/01/2003">
  5.  
  6.     <!-- Template Header -->
  7.     <TemplateConfiguration>
  8.         <Name>${res:Templates.Project.WindowsService.Name}</Name>
  9.         <Category>VBNET</Category>
  10.         <Icon>VB.Project.ServiceProject</Icon>
  11.         <LanguageName>VBNET</LanguageName>
  12.         <Description>${res:Templates.Project.WindowsService.Description}</Description>
  13.     </TemplateConfiguration>
  14.     
  15.     <!-- Actions -->
  16.     <Actions>
  17.         <Open filename = "MyService.vb"/>
  18.     </Actions>
  19.     
  20.     <Combine name = "${ProjectName}" directory = ".">
  21.         <Options>
  22.             <StartupProject>${ProjectName}</StartupProject>
  23.         </Options>
  24.         
  25.         <Project name = "${ProjectName}" directory = ".">
  26.             
  27.             <Options Target = "Library" PauseConsoleOutput = "False"/>
  28.             
  29.             <Files>
  30.                 <File name="MyService.vb"><![CDATA[${StandardHeader.VBNET}
  31. Imports System
  32. Imports System.Collections
  33. Imports System.ComponentModel
  34. Imports System.Data
  35. Imports System.Diagnostics
  36. Imports System.ServiceProcess
  37. Imports System.Configuration.Install
  38.  
  39. Public Class MyService
  40.     Inherits System.ServiceProcess.ServiceBase
  41.  
  42.     Public Sub New()
  43.         MyBase.New()
  44.         
  45.         InitializeComponents()
  46.         
  47.         ' TODO: Add any further initialization code
  48.     End Sub
  49.     
  50.     <System.Diagnostics.DebuggerStepThrough()> _ 
  51.     Private Sub InitializeComponents()
  52.         Me.ServiceName = "Service1"
  53.     End Sub
  54.     
  55.     ' This method starts the service.
  56.     <MTAThread()> _
  57.     Shared Sub Main()
  58.         
  59.         ' To run more than one service you have to add them to the array
  60.         System.ServiceProcess.ServiceBase.Run(New System.ServiceProcess.ServiceBase() { _
  61.             New MyService _
  62.         })
  63.     End Sub
  64.     
  65.     ' Clean up any resources being used.
  66.     Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
  67.         MyBase.Dispose(disposing)
  68.         ' TODO: Add cleanup code here (if required)
  69.     End Sub
  70.     
  71.     Protected Overrides Sub OnStart(ByVal args() As String)
  72.         ' TODO: Add start code here (if required)
  73.         '       to start your service.
  74.     End Sub
  75.     
  76.     Protected Overrides Sub OnStop()
  77.         ' TODO: Add tear-down code here (if required) 
  78.         '       to stop your service.
  79.     End Sub
  80.  
  81. End Class
  82.  
  83. <RunInstaller(True)> _
  84. Public Class ProjectInstaller
  85. Inherits Installer
  86.  
  87.     Public Sub New()
  88.         Dim spi As ServiceProcessInstaller = New ServiceProcessInstaller 
  89.         spi.Account = ServiceAccount.LocalSystem
  90.         Dim si As ServiceInstaller = New ServiceInstaller 
  91.         si.ServiceName = "Hello Service Template"
  92.         si.StartType = ServiceStartMode.Automatic
  93.         Installers.AddRange(New Installer()  {spi, si})
  94.     End Sub
  95. End Class 
  96. ]]></File>
  97.         <File name="AssemblyInfo.vb">
  98.             <![CDATA[Imports System.Reflection
  99. Imports System.Runtime.CompilerServices
  100.  
  101. ' Information about this assembly is defined by the following
  102. ' attributes.
  103. '
  104. ' change them to the information which is associated with the assembly
  105. ' you compile.
  106.  
  107. <assembly: AssemblyTitle("")>
  108. <assembly: AssemblyDescription("")>
  109. <assembly: AssemblyConfiguration("")>
  110. <assembly: AssemblyCompany("")>
  111. <assembly: AssemblyProduct("")>
  112. <assembly: AssemblyCopyright("")>
  113. <assembly: AssemblyTrademark("")>
  114. <assembly: AssemblyCulture("")>
  115.  
  116. ' The assembly version has following format :
  117. '
  118. ' Major.Minor.Build.Revision
  119. '
  120. ' You can specify all values by your own or you can build default build and revision
  121. ' numbers with the '*' character (the default):
  122.  
  123. <assembly: AssemblyVersion("1.0.*")>
  124.  
  125. ' The following attributes specify the key for the sign of your assembly. See the
  126. ' .NET Framework documentation for more information about signing.
  127. ' This is not required, if you don't want signing let these attributes like they're.
  128. <assembly: AssemblyDelaySign(false)>
  129. <assembly: AssemblyKeyFile("")>]]></File>
  130.             </Files>
  131.         </Project>
  132.     </Combine>    
  133. </Template>
  134.  
  135.