2012-10-09 21 views
4

當我嘗試使用BackgroundAgent時,我在系統設置中打開後臺應用程序屏幕時收到以下錯誤消息。使用BackgroundAgent時丟失的組件

System.IO.FileNotFoundException了未處理消息=文件或 集名稱 '\應用程序\安裝\ EC78F0AC-625D-482E-9ADD-D48D58BE633A \安裝\ MyAgent.dll', 或它的一個依賴, 沒找到。堆棧跟蹤: 在System.ThrowHelper.throwVersion37CompatException(ExceptionType newEType,字符串newString,ExceptionType oldEType,字符串oldString) 在System.Reflection.Assembly.LoadFrom(字符串assemblyFile) 在Microsoft.Phone.BackgroundAgentActivator.LoadEntryPointAssembly(字符串 的AssemblyName) 在Microsoft.Phone.BackgroundAgentActivator.LoadAgent(字符串的AssemblyName,字符串的typeName) 在Microsoft.Phone.BackgroundAgentActivator.Microsoft.Phone.IBackgroundAgentActivator.CreateBackgroundAgent(字符串 組件,字符串所屬類別) 在Microsoft.Phone.BackgroundAgentDispatcher.AgentRequest.Invoke () at Microsoft.Phone.BackgroundAgentDispatcher.InvocationThread() 在System.Threading.ThreadHelper.ThreadStartHelper(ThreadHelper噸) 在System.Threading.ThreadHelper.ThreadStart_Context(對象狀態) 在System.Threading.ExecutionContext.Run(的ExecutionContext的ExecutionContext,ContextCallback回調,對象狀態) 在的System.Threading .ThreadHelper.ThreadStartHelper()

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

提供的示例工作,但是當我嘗試實現它時,它不..很遺憾,我無法在網上找到任何東西。

任何想法是怎麼回事?

親切的問候, 尼爾斯

回答

4

通過觀察異常的問題可能是,你是不是在你的主要項目引用MyAgent.dll。添加後臺任務作爲參考,並確保將其添加到WMAppManifest.xml中(用實際裝配名稱和任務類別名稱替換它)。

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