19 June 2007
As the Silverlight tools story is still young (Visual Studio 2008 really is looking amazing though), I thought I’d share a few solutions I’ve come across while working on Silverlight.
If you’re using Visual Studio 2005 for Silverlight application development (also here), these tips are for you!
Depending on your personal preference for web development, you may find it handy to simply have your Silverlight class libraries build directly into your %systemdrive%\inetpub\wwwroot\projectDirectory\ folder.
If you’re also deploying ASP.NET pages, you’ll want to convert the directory into a virtual directory application also.
Managed debugging works with both Firefox & Internet Explorer, and often you can track down bugs and unknown behavior by intercepting all managed exceptions from within Visual Studio. Instead of having to attach to the Firefox.exe process with each execution, you can just add a new configuration to start it with a press of F5.
In Visual Studio 2005, you can easily add new project configurations & set the debugging parameters to save time:
Just select the configuration you’d like to execute your application with and debug away!
Once you’ve created one of these projects, you can use the “Export Template” wizard within the File menu to save this as a new template too.
A friendly reminder that your web server should be serving PDBs in order to get anything useful out of your debugging experience. You should probably enable serving .pdb, .xaml, and .dll files from any directories where you’re wanting to place your applications created for Silverlight.
On IIS: Add appropriate MIME types in inetmgr. You can use application/x-msdownload, application/xaml+xml, application/octet-steam, as long as it’s a servable type it should be good to go.
On Apache: I’m able to have xaml, pdb, and dll all served out of the box running Apache 2.2.2 on Linux, without any configuration changes or new directives.
I’ve seen some people utilize the WebApplication.CreateScriptableObject method in their loaded event, and then on their JavaScript page assuming that immediately after calling CreateSilverlight() you can access Control1.content.YourScriptableObject.YourScriptableProperty.
This isn’t the case, please make sure to check whether Control1 && Control1.content are null, or use the onLoad event of the Silverlight createObjectEx method in Silverlight.js.
Hope this helps everyone out there playing around with the Silverlight MIX CTP bits!
Jeff Wilcox is a Software Engineer at Microsoft in the Open Source Programs Office (OSPO), helping Microsoft engineers use, contribute to and release open source at scale.