I define MySettingsProvider class that is derived from LocalFileSettingsProvider and used for storing apllication settings. The settings are used in service installer instance. I'm trying to install my service using InstallUtil:
InstallUtil MyService.exe
If I place InstallUtil.exe file to the same directory as the service, then installation proccess is completed successfully. If I try to call InstallUtil.exe via PATH environment variable then the following error occurs:
System.Configuration.ConfigurationErrorsException: Could not load provider type: MyService.MySettingsProvider, MyService, Version=1.0.7051.29790, Culture=neutral, PublicKeyToken=null.
I tried to define MySettingsProvider and MyService in different assemblies, but results are same. Why the utility cannot use a custom settings provider class that is defined in same assembly as a service installer? Is it possible to solve the issue without coping InstallUtil.exe to installation folder?
You could try to give the full path to InstallUtil
"C:\Windows\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe" ServiceName.exe