So I've seen the release of Silverlight 3 coming for a while now and we've had some discussion about upgrading or not. In the end, we concluded that the only reason not to upgrade would be a big impact on our existing application. We decided we would have to wait for the final release before testing it with our current code.
I've heard a lot about backwards compatibility, but I've heard that before with other upgrades and I had a lot of disappointment when actually trying that out. When it comes to backwards compatibility, I guess seeing is believing. So last week, I took some time to check out the upgrade to Silverlight 3.
To make sure I wouldn't do anything to my own development environment, I decided to take a virtual machine and test it on that. Here is what steps I planned to test our application with Silverlight 3:
- Install the Silverlight 3 Runtime
- Test our application with the Silverlight 3 Runtime
- Install a Silverlight 3 development environment
- Change the .aspx page to use the
object
tag instead of the asp:Silverlight
control
- Get the complete solution to compile
- Get the application to run
- Test for behavior changes
The first two steps were a breeze and everything worked as expected. This was great, but I had somewhat expected this as the Silverlight 3 Runtime was still handling my application as if it was a Silverlight 2 application. Test passed.
Because all I wanted to do with the development environment was test the Silverlight 3 migration of our client software, I decided to use the new Microsoft Web Platform Installer to setup the tools needed. I haven't tried it before, so I didn't know what to expect. Actually, I had only one surprise during setup, which was with the installation of IIS. It requested me to insert the disks for, in this case, Windows XP SP2, so it could copy the files for IIS from that disk.
Other than that, which is still a logical choice as IIS is obviously part of the Windows license you have, everything was downloaded and installed automatically and I was done installing everything in two hours, while reading up on breaking changes between Silverlight 2 and 3 (weird for a backwards compatible release, right :-p). All in all, I was pleasantly surprised by this great new solution from Microsoft and I hope they soon allow us to install your licensed version of Visual Studio trough the WPI.
Now that I was ready to test the actual upgrading of my application to Silverlight 3, I copied the sources to my virtual machine and opened the solution with Visual Web Developer. Apart from some mistakes where I forgot to copy some linked files, it opened and converted my solution without any hickup. After putting in the missing files, it compiled without problems. I pressed F5 and waited with anticipation ... it worked on the first try! However, I was going a little to fast as I didn't replace the asp:Silverlight
tag with the object
tag and it was still running with the famous quirks mode enabled (as the minimal version still pointed to Silverlight 2). I replaced the asp:Silverlight
tag with the object
tag as it looks below:
<div id="silverlightControlHost">
<object data="data:application/x-silverlight-2,"
type="application/x-silverlight-2" width="100%" height="100%">
<param name="source" value="ClientBin/someapp.xap"/>
<param name="onerror" value="onSilverlightError" />
<param name="background" value="white" />
<param name="minRuntimeVersion" value="3.0.40624.0" />
<param name="autoUpgrade" value="true" />
<a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=3.0.40624.0"
style="text-decoration: none;">
<img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight"
style="border-style: none"/>
</a>
</object>
<iframe id="_sl_historyFrame" style='visibility:hidden;height:0;width:0;border:0px'>
</iframe>
</div>
I ran the application again ... and it still worked as expected! After some more testing, the only change in behavior that I could find in our application was with the ListBox.ScrollIntoView
method. In Silverlight 2, if you would call this with the last item in the listbox
, it would scroll it into view, but it would still be at the bottom of the screen. In Silverlight 3, if you call this with the last item, it will actually scroll the item to the top of the listbox
, showing empty space below it. As this is the preferred behavior in our case, I haven't done any research to see if I could change it.
All in all, this has been one of the most painless migrations I have experienced ever. Microsoft, my compliments on a job well done.