WMI Programming with Visual Basic.NET: Combining with Windows Services - Adding the installers and setup
(Page 4 of 5 )
The following steps add service installers to your application:
o Switch to the design mode of “WMISvc.vb” (or just double click on “WMISvc.vb” in solution explorer).
o Right click on the empty space and choose “Add Installer” as shown in the following figure (Fig 2).

o You should be able to see “ProjectInstaller.vb” created automatically for you with two components, “ServiceProcessInstaller1” and “ServiceInstaller1”.
o Right click on “ServiceProcessInstaller1”, go to properties and change the property “Account” to “LocalSystem” as shown in the following figure (Fig 3).

The following steps add setup to your application:
o Within the Solution Explorer, right click on the solution and go to Add -> New project.
o Select Project Type as “Setup and Deployment Projects” and Templates as “Setup Project”.
o Provide name as “WMIServiceSetup” and store at your location (generally I store it within the same path of “WMIService”) as shown in the following figure (Fig 4).

o From the Solution Explorer, right click on “WMIServiceSetup” and go to Add -> Project Output.
o Within the “Add Project Output Group” window, select Project as “WMIService” (which should be there by default) and choose “Primary Output” in the listbox below. Finally click OK.
o From the Solution Explorer, right click again on “WMIServiceSetup” and go to View -> Custom Actions. You will be presented with another tabbed window.
o Right click on “Custom Actions” and choose “Add Custom Action”.
o Select “File System on Target Machine” from the “Look in” drop down list and click on OK.
o It shows “Applicaton Folder” in the drop down list. Select “Primary output from WMIService(Active)” from the listbox and click on OK. And you should be able to see something like the following (Fig 5).

o Right click again on “WMIServiceSetup” project and choose Rebuild. The solution should be built successfully (with both projects) at this moment.
Next: Installing, executing and testing the windows service >>
More Visual Basic.NET Articles
More By Jagadish Chaterjee