oHost = New SquirreledHost(oService, Assembly.GetCallingAssembly, oSelfUpdater, True, RunAS.LocalSystem)
oHost.ConfigureAndRun(Sub(HostConfig)
HostConfig.Service(Of ServiceHosted)(Sub(s) <---- ERROR HERE
s.ConstructUsing(Function(name) New ServiceHosted())
s.WhenStarted(Function(tc) tc.Start)
s.WhenStopped(Function(tc) tc.Stop)
s.WhenPaused(Function(tc) {})
s.WhenContinued(Function(tc) {})
End Sub)
HostConfig.EnableServiceRecovery(Function(rc) rc.RestartService(1))
HostConfig.EnableSessionChanged()
HostConfig.UseNLog
HostConfig.StartAutomatically
End Sub)
Public Class ServiceHosted
Implements ISelfUpdatableService
Public Sub Start() Implements ISelfUpdatableService.Start
End Sub
Public Sub [Stop]() Implements ISelfUpdatableService.Stop
End Sub
Private Shared ReadOnly Log As LogWriter = HostLogger.Get(GetType(ServiceHosted))
End Class
This is all very strange because it's the same construct as the sample. And the sample builds without any problem.
How is the sample project able to 'fool' Topshelf into thinking that the implementation is correct? This has really got me scratching my head.