Silverlight 1.1 Projects Running From Filesystem

I've seen the same question a few times now about how you can create a Silverlight 1.1 project that doesn't run from the filesystem. By default, when you create a Silverlight 1.1 project in Visual Studio 2008 and hit F5 (run), IE will fire up with a filesystem URL as below (ie your page isn't being served by a webserver).

image

So what if I want to make use of webservices or the downloader object? You need to get your Silverlight 1.1 app running in the context of a website...

  • imageAdd a new website to your solution
  • Add a "Silverlight Link" (right click the website and select "Add Silverlight Link..." - see left)
  • I suggest you enable Silverlight debugging when prompted. Otherwise you can enable it later from the website properties (see left below)
  • The act of adding the Silverlight link will copy your XAML and Silverlight assembly to the website project and re-copy these each time you build
  • Copy Silverlight.js and your html / html.js files from your Silverlight project to the website
  • You should now be able to run your Silverlight app from the website project either by setting the html page as the default or right-clicking and selecting "View in Browser" in the usual way

image

 

 

 

 

 

Technorati Tags: silverlight