Partager via


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

Comments

  • Anonymous
    August 21, 2007
    On a seperate but similar point :) I've posted an article on my blog which covers if you want to be able to develop something which does run under file system mode (but also equally capable of running in online mode, and in that case use the downloader object). http://silverlightuk.blogspot.com/2007/08/silverlight-downloader-which-works-both.html

  • Anonymous
    August 21, 2007
    I've been umming and ahhing about what to do with this now that I have changed roles and no longer getting

  • Anonymous
    August 21, 2007
    I've been umming and ahhing about what to do with this now that I have changed roles and no longer

  • Anonymous
    August 22, 2007
    The comment has been removed

  • Anonymous
    September 19, 2007
    Great tip Mike! Cheers, Liam