This error “usually happens when you changed the namespace of your app [and] then did not change the Startup Object in the project property.”
I did just do a big refactoring and renamed a lot of stuff – including renaming the Silverlight project – so I figured that this was the problem.
Unfortunately, I didn’t immediately know what he meant.

The answer, open the Solution (sln) that has your Silverlight 4 project. Go to the Silverlight project (not the *.Web project), right-click the project
and choose Properties. When the Project Properties page comes up, click the Silverlight tab and you should see the screen below.

When I went to the Silverlight tab for my project, I found that the Startup object was indeed set to the old name and namespace for App.xaml.

Now, open the Startup object dropdown. The old value isn’t even available in the list anymore. Choose the right value from the Startup object dropdown list,
Save the project, and now your Silverlight application should run.