[Mono-list] Installing Windows service on Windows

Robert Jordan robertj at gmx.net
Wed Nov 2 11:36:34 EDT 2011


On 02.11.2011 16:20, Erik Cederstrand wrote:
> Hi all,
>
> (Newbie warning) I have created a test Windows Service using Mono 2.10.6 and MonoDevelop 2.8.1 on OSX and compiled it against .NET 4.0 to an executable. I then wanted to install it on my Windows 7 VM (Mono is not installed there) using InstallUtil.exe, but I get the following error.
>
>    PS F:\>  C:\windows\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe OneCalService.exe
>    Microsoft (R) .NET Framework Installation utility Version 4.0.30319.1
>    Copyright (c) Microsoft Corporation.  All rights reserved.
>
>    Exception occurred while initializing the installation:
>    System.IO.FileLoadException: Could not load file or assembly 'file:///F:\OneCalService.exe' or one of its dependencies.
>    The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG)).
>
>
> Am I doing something unsupported? How do I create a Windows Service using Mono, and install it on a Windows machine that only has .NET installed?

You did not provide any metadata necessary for InstallUtil.

You must implement a System.Configuration.Install.Installer
subclass and configure the service with

System.ServiceProcess.ServiceProcessInstaller

and

System.ServiceProcess.ServiceInstaller.

You can find their docs (and samples) on MSDN.

Robert



More information about the Mono-list mailing list