c# - 使用 BackgroundAgent 时程序集丢失

标签 c# silverlight windows-phone-7

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

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()

我使用了这个教程:http://rodrigueh.com/wp7-live-tiles-with-background-agents .

提供的示例有效,但当我尝试实现它时却没有。不幸的是,我无法在网上找到任何东西。

有什么想法吗?

亲切的问候, 尼尔斯

最佳答案

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

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

关于c# - 使用 BackgroundAgent 时程序集丢失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12801934/

相关文章:

c# - 删除 Console.Write 方法写入的字符

.net - 将行颜色绑定(bind)到 MVVM 中的属性(取决于行中的数据)

c# - 如何在整个应用程序中设置通用日期格式 - Silverlight/Windows Phone 7

c# - 是否有任何方法可以截断字符串的一部分,直到在 C# 中遇到第一个数字?

c# - 如何检测谁在说话

silverlight - 访问控制服务和 Multi-Tenancy 应用

silverlight - Com Interop 问题 Silverlight 4 和 MS Access 2010

image - 如何将图像背景设置为重复?

iphone - 嵌入式计算机视觉平台

c# - 使用反射查找具有自定义属性的方法