Search code examples
c#windows-phone-7windows-phone-7.1background-agents

Windows Phone background agent Microsoft.Phone.dll submission issue


I am trying to submit an app to the app hub, whick is using a backgound agent to update the app tile. the background agent requires to use the Microsoft.Phone.dll, but when I submit the app i get the following errors

2011: The background agent can’t use Microsoft.Phone.Shell.ShellTile::Create, which assembly TileAgent.dll is trying to use. Update your file and then try again.

2011: The background agent can’t use System.Windows.Controls.MediaElement::Pause, which assembly Microsoft.Phone.dll is trying to use. Update your file and then try again.

2011: The background agent can’t use System.Windows.Controls.MediaElement::Stop, which assembly Microsoft.Phone.dll is trying to use. Update your file and then try again.

2011: The background agent can’t use System.Windows.Controls.MediaElement::Play, which assembly Microsoft.Phone.dll is trying to use. Update your file and then try again.

2011: The background agent can’t use System.Windows.Controls.MediaElement::set_Position, which assembly Microsoft.Phone.dll is trying to use. Update your file and then try again.

2011: The background agent can’t use System.Windows.Controls.MediaElement::set_AutoPlay, which assembly Microsoft.Phone.dll is trying to use. Update your file and then try again.

2011: The background agent can’t use System.Windows.Controls.MediaElement, which assembly Microsoft.Phone.dll is trying to use. Update your file and then try again.

2011: The background agent can’t use System.Windows.Controls.MediaElement::SetSource, which assembly Microsoft.Phone.dll is trying to use. Update your file and then try again.

2011: The background agent can’t use System.Windows.Media.VideoBrush, which assembly Microsoft.Phone.dll is trying to use. Update your file and then try again.

2011: The background agent can’t use System.Windows.Controls.MediaElement::.ctor, which assembly Microsoft.Phone.dll is trying to use. Update your file and then try again.

although I am not using any of those assemblies, or reference them anywhere in the agent's project. please help!

EDIT: I removed the create tile method, and now this error is gone. the rest though remain the same, although I am not using any of them There is absolutely no use of the System.Widnows.Contols in this project

EDIT: Here is the list of referenced i have in the agent's project

Microsoft.Phone
mscorelib
mscorelib.extensions
system
System.Core
System.Net
System.Windows
System.Xml

Solution

  • Your agent has some references to code wich uses listed API. For example:

    You have some class wich creates new tile. Microsoft.Phone.Shell.ShellTile::Create. And your background agent lives in the same proj, or your bg agent uses code wich lives in proj where you create new tile.

    Some illustration:

    proj A

     //draws tile 
     public class TileBuilder() {}
     //creates new tile using TileBuilder() 
     public class NewTileManager(TileBuilder tBuilder) 
     {
     }
    

    proj B

      public class ScheduledAgent : ScheduledTaskAgent
      {
          protected override void OnInvoke(ScheduledTask task)
          {
            //update data
            var tBuilder = new TileBuilder(); // oops, you use code from proj A. 
                                              // So, you have it
                                              // as a reference, And MS thinks that 
                                              // your bgAgent uses forbidden API
    
          }
    
    }