How to test your Silverlight quickly

Published Fri, Aug 17 2007 15:32

When you create a Silverlight project, you'll automatically get an HTML file that you can open in the browser to run some quick tests. Unfortunately, the file is opened directly from the file system instead of being served from a web server. This means that some things don't work and you'll need to create a web site to test them (ex.: getting a video file and making it play on the MediaElement element).

Most of the time, I'm not developing Silverlight applications; i'm just writing some tests to see if something works as expected. in these cases, having to create a web application and adding pages to it might be a little bit overkill. So, instead of creating a web site and adding a Silverlight link to it (and chaning the properties of the HTML/js files  in order to get them automatically on the web site), I just add an existing web site that points to the folder that contains the Silverlight project.

Here's how you do it:

  1. create a new Silverlight project
  2. go to the file menu and choose add -> existing web site
  3. since you can use the file sytem server for testing these functionalities, just navigate until you get the folder that has the silverlight project created in 1
  4. click open

And that's it. you'll get a solution with 2 projects which are just different views of the same project. When I need to write some code, I just open the file from the Silverlight project. When i need to test it, I right click the HTML file on the Web project and choose the view in browser option.

Filed under:

Leave a Comment

(required) 
(required) 
(optional)
(required) 
If you can't read this number refresh your screen
Enter the numbers above:  

Search

This Blog

Tags

Community

Archives

Syndication

Email Notifications

News




  • View Luis Abreu's profile on LinkedIn


    Follow me at Twitter

    My books

    Silverlight 4.0: Curso Completo

    ASP.NET 4.0: Curso Completo

    Portuguese LINQ book cover

    Portuguese ASP.NET 3.5 book cover

    Portuguese ASP.NET AJAX book cover

    Portuguese ASP.NET AJAX book cover