Wednesday, December 5, 2012

Silverlight initalization error

So I was copying and pasting some classes into my Silverlight project and when I ran it gave me a pop-up window saying it couldn't initialize the Silverlight app.

A cursory look revealed that I had accidentally deleted the "ClientBin" folder from my Silverlight web project (remember that there is the client piece and the web piece on SL apps).  I added the folder back but the XAP file wasn't there!

I did a search and didn't find the solution for this but I figured it out so I wanted to make it available.

You'll need to go into the project properties (right click on the .WEB project and choose properties).  Under the Silverlight Applications tab you will need to add the application.

Click "Add" then choose "use an existing Silverlight project in the solution" and add the SL project into the project.

As part of this it will also recreate the ASPX and HTML page(s) if you accidentally deleted those as well.

The exact message from the browser is: "Error: Unhandled Error in Silverlight Application
Code: 2104     Category: InitializeError  Message: Could not download the Silverlight application. Check web server settings".