4

I have created a window service using c# in visual studio 2013. Windows service is working fine.

When i create a setup project and run the .msi file in different computer it gives me an error

Error

Steps I did :

1.Right click on solution -> Other Project Types ->Visual Studio Installer - Setup Project

2.After adding the name File system Editor -> Select Application Folder -> Right click -> Add -> Project output -> Add Project Output Group pop up Project : selected my project with Primary Output

File system editor

  1. Select Custom Action Editor -> Install -> Right CLick -> Add Custom Action -> Select the Application folder and the Project output.

Repeated the same for Uninstall

Custom Actions Editor

  1. Build the Installer.

.msi and setup.exe file is created in the folder.

I saw https://www.youtube.com/watch?v=cp2aFNtcZfk tutorial to do this.

Can any tell me how to solve this.

Thanks


Edit : I have projectInstaller in my Project

namespace certify4byd_ver2._0
{
partial class ProjectInstaller
{

    private System.ComponentModel.IContainer components = null;

    protected override void Dispose(bool disposing)
    {
        if (disposing && (components != null))
        {
            components.Dispose();
        }
        base.Dispose(disposing);
    }


    private void InitializeComponent()
    {
        this.serviceProcessInstaller1 = new System.ServiceProcess.ServiceProcessInstaller();
        this.serviceInstaller1 = new System.ServiceProcess.ServiceInstaller();
        // 
        // serviceProcessInstaller1
        // 
        this.serviceProcessInstaller1.Account = System.ServiceProcess.ServiceAccount.LocalService;
        this.serviceProcessInstaller1.Password = null;
        this.serviceProcessInstaller1.Username = null;

        // 
        // serviceInstaller1
        // 
        this.serviceInstaller1.Description = "Quick Source specific development to allow ftp files to be send to ByDesign envir" +
"onment";
        this.serviceInstaller1.DisplayName = "Quick Source Certify4ByDesign";
        this.serviceInstaller1.ServiceName = "qs_certify4byd_v2.0";
        this.serviceInstaller1.StartType = System.ServiceProcess.ServiceStartMode.Automatic;
        this.serviceInstaller1.AfterInstall += new System.Configuration.Install.InstallEventHandler(this.serviceInstaller1_AfterInstall);
        // 
        // ProjectInstaller
        // 
        this.Installers.AddRange(new System.Configuration.Install.Installer[] {
        this.serviceProcessInstaller1,
        this.serviceInstaller1});

    }

    #endregion

    private System.ServiceProcess.ServiceProcessInstaller serviceProcessInstaller1;
    private System.ServiceProcess.ServiceInstaller serviceInstaller1;
    }
}
GameBuilder
  • 1,089
  • 3
  • 28
  • 58

1 Answers1

0

From the error message, it looks like you've copied your application's files to the target machine and that's it. If you're writing a Windows Service there are other steps that you have to take to get an MSI package to install it as a service.

Does your project have the ServiceInstaller class somewhere? That's how .NET wants you to install services.

A Visual Studio Installer project is probably not the best way to go, at least in my experience. Have a look at Debuggable Installable Service, an extension for Visual Studio that allows you to create self-installing Windows Services (with a command line argument) that are also console debuggable out of the box. It's been a lifesaver for me when writing services because you're not messing around with ServiceInstaller and everything is done for you.

My other suggestion is, on top of using Debuggable Installable Service, have a look at WiX Toolset. It needs to be installed everywhere you plan on developing your products (a bit of a pain if you're developing under source control), but it also allows you to install services and gives you more fine-grained control of how your applications will be installed.

I don't recommend a Visual Studio Installer project.

Brandon
  • 4,220
  • 4
  • 35
  • 55
  • I have Service Installer in my Project. Please see the Edited area. Thanks for advicing another tool. I have used in VS installer project in Past. I think i have missed something, which i cannot verify. – GameBuilder Jan 14 '16 at 16:27