Creating dll and windows services with VB Express 2005

V

Val3

Hi all.
I need to build dll(s) and windows services using VB .NET 2005 Express. When
I make File/New project the windows contain only Windows application,
Windows control library, Console application, DVD collection starter kit.
How can I do? Any suggest?
Thanks in advance.

VAL
 
G

gaidar

Create a Windows Application in the Visual Studio, then conver it to dll
file and use command-line compiler to build the assembly.

Gaidar
 
R

Robert Schoen

That is a good question. VB Express is a very powerful tools at its limited feature set. With that said, I believe you can still do most things that is in the full featured parent
products it just does not have all the nice built in stuff that makes it really easy....

There are a couple of options....
1. You should be able to take an existing VS7/VS71 windows service project and open it up in the Express sku...migrate it to 2005 and their you go. Except you
probably do not have such a project :(
Or
2. You can create one from "scratch". First create a vb win app - remove the form.vb file and add a new class file - next add a .net reference to System.serviceprocess -
next change the class file code to look something like the below where you handle all methods required for the service.

You will have some additional things to work through but hopefully this will get you started in the write direction.

BTW, the default vb .net windows service project when built into an assembly - is an Exe and not a Dll.

Hope this helps.

Robert

------------------------------------------------------
Imports System.ServiceProcess

Public Class Service1
Inherits System.ServiceProcess.ServiceBase

#Region " Component Designer generated code "

Public Sub New()
MyBase.New()

' This call is required by the Component Designer.
InitializeComponent()

' Add any initialization after the InitializeComponent() call

End Sub

'UserService overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

' The main entry point for the process
<MTAThread()> _
Shared Sub Main()
Dim ServicesToRun() As System.ServiceProcess.ServiceBase

' More than one NT Service may run within the same process. To add
' another service to this process, change the following line to
' create a second service object. For example,
'
' ServicesToRun = New System.ServiceProcess.ServiceBase () {New Service1, New MySecondUserService}
'
ServicesToRun = New System.ServiceProcess.ServiceBase () {New Service1}

System.ServiceProcess.ServiceBase.Run(ServicesToRun)
End Sub

'Required by the Component Designer
Private components As System.ComponentModel.IContainer

' NOTE: The following procedure is required by the Component Designer
' It can be modified using the Component Designer.
' Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
components = New System.ComponentModel.Container()
Me.ServiceName = "Service1"
End Sub

#End Region

Protected Overrides Sub OnStart(ByVal args() As String)
' Add code here to start your service. This method should set things
' in motion so your service can do its work.
End Sub

Protected Overrides Sub OnStop()
' Add code here to perform any tear-down necessary to stop your service.
End Sub

End Class
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top