November Happy Hour will be moved to Thursday December 5th.

Problem with loading Options in Scheduled Job (CMS 12)

Vote:
 

I've got an addon that consits of two nuget packages. One nuget with core functionalidaty and one nuget (that depends on the first nuget) with a scheduled job.

In CMS 11 and earlier versions of CMS 12, this worked without problems, but in later versions of CMS 12 this has stopped working.

Error message when I try to run the job:

Could not load type 'Gulla.Episerver.AutomaticImageDescription.Core.Configuration.AutomaticImageDescriptionOptions' from assembly 'Gulla.Episerver.AutomaticImageDescription.Core, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.

What I'm trying to do is different variations of this, to load the Options (settings) defined in Gulla.Episerver.AutomaticImageDescription, from the job defined in Gulla.Episerver.AutomaticImageDescription.ScheduledJob.

ServiceLocator.Current.GetInstance<IOptions<AutomaticImageDescriptionOptions>>();

I've tried with construction parameter injection. Same error.

Any tips?

#302554
May 29, 2023 12:17
Vote:
 

Hi

Didn't used this package but it looks like 

Gulla.Episerver.AutomaticImageDescription.Core

in this version doesn't contain 

AutomaticImageDescriptionOptions

Make sure you don't have version mismatch

#302772
Jun 01, 2023 8:42
Vote:
 

I added the [ServiceConfiguration] attribute to the class AutomaticImageDescriptionOptions

Now, it works.

#302781
Jun 01, 2023 10:27
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.