Debugging Silverlight Applications in Out Of Browser Mode

On an internal mailing list yesterday, someone asked how to debug their Silverlight 3 application as it runs Out of Browser.  They were seeing some behavior that would only reproduce in the first few seconds and only in OOB mode.  Fortunately, you can install your app locally and then debug it directly in the Out of Browser window.

In the Silverlight project properties, on the debug tab, you can enable launching it as an OOB application:


The drop down box contains all of the web projects in the solution which consume your Silverlight application.  Because they are treated as different installs by the runtime, you may want to change this setting if issues occur when installing from one web project but not another.  The notice below the dropdown simply indicates that you haven’t installed the Silverlight application in the context of that web project yet.  If the notice does not appear, then you’re good to go.

The next step after enabling OOB debugging is to set your Silverlight app to the startup project.  Normally the web project is the startup project, and it hosts the Silverlight app; in this case, we don’t want to run the website.  To set the startup project, just right-click the project in Solution Explorer and select ‘Set as Startup Project’. 


You’ll know which project is set as it will be in bold in Solution Explorer.

Now when you start debugging, the application will launch in Out of Browser mode.  To go back to debugging in the web site’s context, simply change the web project back to being the startup project.