I am getting an error when trying to run Topshelf with Quartz
Topshelf.Hosts.ConsoleRunHost Error: 0 : An exception occurred, System.TypeLoadException: Could not load type
'Quartz.Collection.HashSet`1' from assembly 'Quartz, Version=3.0.7.0, Culture=neutral, PublicKeyToken=*'.
at Topshelf.Quartz.ScheduleJobServiceConfiguratorExtensions.<>c__DisplayClassa`1.<ConfigureJob>b__3()
at Topshelf.Runtime.EventCallbackList`1.Notify(T data)
at Topshelf.Builders.DelegateServiceBuilder`1.DelegateServiceHandle.Start(HostControl hostControl)
at Topshelf.Hosts.ConsoleRunHost.Run()
My code is
HostFactory.Run(x =>
{
x.Service<Service>(s =>
{
s.WhenStarted(service => service.Start());
s.WhenStopped(service => service.Stop());
s.ConstructUsing(() => new Service());
s.ScheduleQuartzJob(q =>
q.WithJob(() =>
JobBuilder.Create<Notifications>().Build())
.AddTrigger(() => TriggerBuilder.Create()
.WithSimpleSchedule(b => b.WithIntervalInSeconds(10)
.RepeatForever())
.Build()));
});
x.RunAsLocalSystem()
.StartAutomatically();
x.SetDescription("Quartz Service");
x.SetDisplayName("QuartzService");
x.SetServiceName("QuartzService");
});
I can't seem to find anything in relation to Quartz.Collection.Hashset with a google search and i'm unsure how to go about getting it if it is missing.
I've put this down to the Quartz.Topshelf Nuget package not supporting .net core and had to resort to creating a windows service instead.
It appears you can do some very simple service creation with .net core 3.0 and above. So it renders Topshelf pretty much obselete. So this is defintely a better option.
Marking this as the answer unless this questions gets found by someone and they find a solution