16
votes

When i trying to register a background task in windows phone 8.1 insted of this sample http://code.msdn.microsoft.com/windowsapps/Tile-Update-every-minute-68dbbbff i got this error :

Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))

i use this code :

Dim taskBuilder As New BackgroundTaskBuilder()
taskBuilder.Name = taskName
taskBuilder.TaskEntryPoint = taskEntryPoint
taskBuilder.SetTrigger(New SystemTrigger(SystemTriggerType.UserPresent, False))
taskBuilder.Register()

Any help please ?

3

3 Answers

33
votes

Make sure your taskEntryPoint variable value matches the Entry point: value you have defined in Package.appmanifest >>> Declarations >>> Background Tasks >>> Entry point.

5
votes

I found the answer (for me). I didn't pay attention to capitalization in my declaration in the Package.appmanifest. In there I set the entry point as Projectname.ClassName and when I was SetTrigger in code, I set it as ProjectName.ClassName.

My what a difference a letter makes!

0
votes

For me, I'd made the mistake of putting the 'Background Tasks' declaration (where I specified the Entry Point) into the appxmanifest of the BackgroundTask project itself... whereas it needs to go into the appxmanifest of the project which registers the background task, which in my case was the UI project.