C# 使用BackgroundAgent时缺少程序集

C# 使用BackgroundAgent时缺少程序集,c#,silverlight,windows-phone-7,C#,Silverlight,Windows Phone 7,当我尝试使用BackgroundAgent时,在系统设置中打开后台应用程序屏幕时,会收到以下错误消息 System.IO.FileNotFoundException未经处理消息=文件或 程序集名称 “\Applications\Install\EC78F0AC-625D-482E-9ADD-D48D58BE633A\Install\MyAgent.dll”, 或其某个依赖项未找到。堆栈跟踪: 在System.ThrowHelper.throwVersion37CompatException处(E

当我尝试使用BackgroundAgent时,在系统设置中打开后台应用程序屏幕时,会收到以下错误消息

System.IO.FileNotFoundException未经处理消息=文件或 程序集名称 “\Applications\Install\EC78F0AC-625D-482E-9ADD-D48D58BE633A\Install\MyAgent.dll”, 或其某个依赖项未找到。堆栈跟踪: 在System.ThrowHelper.throwVersion37CompatException处(ExceptionType newEType,String newString,ExceptionType oldeype,String oldString) 位于System.Reflection.Assembly.LoadFrom(字符串汇编文件) 位于Microsoft.Phone.BackgroundAgentActivator.LoadEntryPointAssembly(字符串 汇编名称) 在Microsoft.Phone.BackgroundAgentActivator.LoadAgent(String assemblyName,String typeName) 位于Microsoft.Phone.BackgroundAgentActivator.Microsoft.Phone.IBackgroundAgentActivator.CreateBackgroundAgent(字符串 程序集,字符串类型信息) 在Microsoft.Phone.BackgroundAgentDispatcher.AgentRequest.Invoke()上 在Microsoft.Phone.BackgroundAgentDispatcher.InvocationThread()上 在System.Threading.ThreadHelper.ThreadStartHelper(ThreadHelper t)上 位于System.Threading.ThreadHelper.ThreadStart\u上下文(对象状态) 在System.Threading.ExecutionContext.Run(ExecutionContext ExecutionContext,ContextCallback回调,对象状态) 在System.Threading.ThreadHelper.ThreadStartHelper()中

我使用了这个教程:

提供的示例是有效的,但是当我尝试实现它时,它就不起作用了。。不幸的是,我在网上找不到任何东西

知道发生了什么事吗

亲切问候,,
Niels

通过查看异常,问题可能是您没有在主项目中引用MyAgent.dll。添加后台任务作为引用,并确保已将其添加到WMAppManifest.xml中(将其替换为实际程序集名称和任务类名称)


  <ExtendedTask Name="BackgroundTask">
    <BackgroundServiceAgent Specifier="ScheduledTaskAgent" Name="MyAgent" Source="MyAgent" Type="MyAgent.ScheduledAgent" />
  </ExtendedTask>