IGlobalConfiguration is not defined error after strong naming assembly

`Error	CS0012	The type 'IGlobalConfiguration<>' is defined in an assembly that is not referenced. You must add a reference to assembly 'Hangfire.Core, Version=1.6.2.0, Culture=neutral, PublicKeyToken=null'.`

`Error	CS0012	The type 'IBootstrapperConfiguration' is defined in an assembly that is not referenced. You must add a reference to assembly 'Hangfire.Core, Version=1.6.2.0, Culture=neutral, PublicKeyToken=null'.`

I’m getting the two errors above after strong naming the Hangfire.Core and Hangfire.SqlServer assemblies. Wondering if anybody has experienced anything similar? I have an older version of Hangfire working correctly but needed to update the Newtonsoft.Json assembly.

I’m writing out the method call like so:

GlobalConfiguration.Configuration.UseSqlServerStorage("connectionstring", new SqlServerStorageOptions { PrepareSchemaIfNecessary = false }).UseNinjectActivator(kernel);

1 Like

Solved my issue. For anyone searching for an easy way to strongly name Hangfire this is what I did.

  1. Fix Nuget packages
    a. Uninstall ‘Dapper’ and ‘Ncrontab’
    b. Install ‘Dapper.StrongName’ and ‘Ncrontab.Signed’
    c. Restore other packages
  2. Clean/Build solution (or just Hangfire.Core)
    a. Strongly name Hangfire.Core via vscmd line (put your key in the same dir as the dll)
    i. >ildasm /all /out=Hangfire.Core.il Hangfire.Core.dll
    ii. >ilasm /dll /key=yourkey.snk Hangfire.Core.il
    b. Copy strongly named Hangfire.Core dll into new folder (I created lib folder at sln root)
  3. Clean/Build just Hangfire.SqlServer
    a. Delete reference to Hangfire.Core
    b. Add reference to new strongly named Hangfire.Core
    c. Build strongly named Hangfire.SqlServer via vscmd line
    i. >ildasm /all /out=Hangfire.Core.il Hangfire.Core.dll
    ii. >ilasm /dll /key=yourkey.snk Hangfire.Core.il

Hope this helps someone looking.

1 Like