使用BackgroundAgent时装配丢失(Assembly missing when using BackgroundAgent)

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

System.IO.FileNotFoundException未处理Message =文件或程序集名称'\ Applications \ Install \ EC78F0AC-625D-482E-9ADD-D48D58BE633A \ Install \ MyAgent.dll'或其中一个依赖项未找到。 StackTrace:位于Microsoft.Phone的Microsoft.Phone.BackgroundAgentActivator.LoadEntryPointAssembly(String assemblyName)的System.Reflection.Assembly.LoadFrom(String assemblyFile)上的System.ThrowHelper.throwVersion37CompatException(ExceptionType newEType,String newString,ExceptionType oldEType,String oldString)。 Microsoft.Phone.BackgroundAgentDispatcher上的Microsoft.Phone.BackgroundAgentDispatcher.AgentRequest.Invoke()中的Microsoft.Phone.BackgroundAgentActivator.Microsoft.Phone.IBackgroundAgentActivator.CreateBackgroundAgent(String assembly,String typeinfo)中的BackgroundAgentActivator.LoadAgent(String assemblyName,String typeName)。 InvocationThread()位于System.Threading的System.Threading.Thread.ThreadStartHelper(ThreadHelper t)处System.Threading.ThreadStart_Context(Object state)处于System.Threading的System.Threading.ExecutionContext.Run(ExecutionContext executionContext,ContextCallback callback,Object state)。 ThreadHelper.ThreadStartHelper()

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

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

有什么想法发生了什么?

亲切的问候,尼尔斯

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

最满意答案

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

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

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

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

更多推荐

System,String,Microsoft,电脑培训,计算机培训,IT培训"/> <meta name="descr