When I try to use a BackgroundAgent I get the following error message when I open up the Background Applications screen at the System Settings.
System.IO.FileNotFoundException was unhandled Message=File or
assembly name
‘\Applications\Install\EC78F0AC-625D-482E-9ADD-D48D58BE633A\Install\MyAgent.dll’,
or one of its dependencies, was not found. StackTrace:
at System.ThrowHelper.throwVersion37CompatException(ExceptionType
newEType, String newString, ExceptionType oldEType, String oldString)
at System.Reflection.Assembly.LoadFrom(String assemblyFile)
at Microsoft.Phone.BackgroundAgentActivator.LoadEntryPointAssembly(String
assemblyName)
at Microsoft.Phone.BackgroundAgentActivator.LoadAgent(String assemblyName, String typeName)
at Microsoft.Phone.BackgroundAgentActivator.Microsoft.Phone.IBackgroundAgentActivator.CreateBackgroundAgent(String
assembly, String typeinfo)
at Microsoft.Phone.BackgroundAgentDispatcher.AgentRequest.Invoke()
at Microsoft.Phone.BackgroundAgentDispatcher.InvocationThread()
at System.Threading.ThreadHelper.ThreadStartHelper(ThreadHelper t)
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStartHelper()
I used this tutorial: http://rodrigueh.com/wp7-live-tiles-with-background-agents.
The sample provided works, but when I try to implement it it doesn’t.. Unfortunetly I’m not able to find anything online.
Any ideas what is going on?
Kind regards,
Niels
By looking at the exception the problem might be that you are not referencing MyAgent.dll in you main project. Add the background task as a reference and make sure this is added to your WMAppManifest.xml (replace it with actual assembly name and name of the task class.)