How to test your Silverlight quickly
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:
- create a new Silverlight project
- go to the file menu and choose add -> existing web site
- 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
- 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.