Windows Phone ScheduledTask Agents and FileNotFoundException

Maybe this is a problem that I’m all alone on, but it took me some time to figure out.

I started up a ScheduledAgent for Windows Phone so that I could do some updates with a PeriodicTask, but when I ran the app, I was getting:

FileNotFoundException was unhandled – An unhandled exception of type ‘System.UI.FileNotFoundException’ occurred in

Here’s what happened:

I had initially named my ScheduledTask project something stupid, so I needed to re-name it. I did so by clicking on the project name and renaming it.


If I had opened the properties section of the project


I would have seen that my assembly name (which names the actual file we’re looking for) was still the old stupid name


Once I update this name, I need to go to my WMAppManifest.xml file in my startup project and open it with the text editor.

<ExtendedTask Name="BackgroundTask">
    Type="MyScheduledTask.ScheduledAgent" />

It took me some time to figure out what the parameters in the BackgroundServiceAgent meant so:

Specifier – ScheduledTaskAgent

Name – the string name you give your task when you start it. In the example below, it would be Name=MyAwesomeTask:

PeriodicTask myPeriodicTask = new PeriodicTask("MyAwesomeTask");

Source – the name of the DLL that holds your task code. This is determined in the Assembly name box you see in the properties section of your csproj.

Type – the namespace.type notation that points to the actual object (which must inherit from ScheduledTaskAgent)

Comments (2)

  1. Rajat Chamria says:

    Thanks a lot for this post. I was banging my head with the wall and wasn't able to figure our the right value to put in the Name field of BackgroundServiceAgent in app manifest file. Thanks for the MSDN page which misguided me.…/ff769509%28v=vs.105%29.aspx

  2. Clive Ciappara says:

    Thanks man you saved me!! Been more than a week trying to figure out why the background agent was not working. I changed the Project name and was using the new name as the Source parameter! Thanks a lot!