| Comments

As we’ve noted before, Visual Studio 2008 doesn’t have multi-targeting support for Silverlight development.  Generally speaking what this means is that if you install the Silverlight 3 tools, you have a Silverlight 3 development environment with VS2008.  True multi-targeting for Silverlight in the IDE will come in Visual Studio 2010 (you can see how that works in this post).

NOTE: Visual Studio 2010 beta 1 (current version available at the time of this writing) does not fully support Silverlight 3 *release version* (also referred to ‘RTM’ or ‘RTW’) development.  There are a few things missing in VS10 beta 1 for full support for SL3 RTW and .NET RIA Services development.  This support will come in later beta builds of VS10 – and no, I have no idea when Visual Studio will be planning on releasing additional beta builds.

But people still want to know how they can build SL2 apps using a single VS2008 machine, no virtual images and without VS2010.  There is a way to do this, but please allow me to set some major caveats.  We must first make sure that what I’m saying here is still that VS2008 does not support multi-targeting IDE development with Silverlight 2 and Silverlight 3.  What I’m also saying is that VS2008 IDE and MSBuild are two different experiences.  MSBuild could care less about an IDE and it just does what it is instructed to do…so let’s instruct it to build Silverlight 2 code, shall we?

Assumptions – please read

Let’s assume this scenario: you are working on SL3 apps so you need the SL3 tools.  Great – install them.  But you also need to either a) support an SL2 application and/or b) for some reason you want to start a new project in Silverlight classic…err, I mean…Silverlight 2.  Okay, let’s proceed with these assumptions and that you already have VS2008 and SL3 dev tools installed.

Step 1: Install the Silverlight 2 SDK

Go grab the Silverlight 2 SDK.  This is different than the Silverlight 2 Tools for Visual Studio.  Don’t install those…you’ll be made at me for no reason if you do.  Again, install the Silverlight 2 SDK.  Once you’ve done that, if you look at your %ProgramFiles%\Microsoft SDKs\Silverlight directory you will see both SDKs installed:

SDK directory with both Silverlight SDKs

Step 2: Create a new project or open your existing Silverlight 2 application

If you are creating a new application and are targeting Silverlight 2 and not taking advantage of all the great new features in Silverlight 3, then create a new Silverlight application.  Obviously (or hopefully so) you cannot choose the Navigation or RIA Services templates…you’ll have to choose the basic Silverlight 2 Application template.  If you are working on an existing SL2 application, open that project.  In this case, VS will convert the project up to an SL3 project.  This is fine for now.

At this point you have your application open in VS and it is basically a SL3 application project.  If you hit F5 at this point, it would build as an SL3 application.

Step 3: Make a copy of the .csproj or .vbproj file

Go to your project’s directory in explorer (fastest way to do this is right-click on the project in Solution Explorer and choose Open Folder in Windows Explorer which is second to the last option by default.  Once in Explorer, make a copy of the .**proj file (either .csproj for C# or .vbproj for Visual Basic).  Name it whatever you want, maybe something like <projectname>-SL2.csproj.

Open that file in notepad or other plain text editor.  You’ll see a line that looks like this (for a default project this is about line 84 – and note the CSharp.Targets will be different if you are using VB):

   1: <Import Project="$(MSBuildExtensionsPath32)\Microsoft\Silverlight\v3.0\Microsoft.Silverlight.CSharp.targets" />

Notice the “v3.0” in the build path?  Alter that only in your copied **proj file to this: (again, noting the difference between CSharp and VB):

   1: <Import Project="$(MSBuildExtensionsPath32)\Microsoft\Silverlight\v2.0\Microsoft.Silverlight.CSharp.targets" />

Basically change the “v3.0” to “v2.0” in that Import node.  This tells the build system to use the SL2 SDK that you installed in Step 1.

Step 4: Modify your build events in VS

At this point, if you still hit F5 you’d be running a SL3 application.  This is still because a) you aren’t opening the altered **proj file we just created in Step 3 and b) you have SL3 tools installed for VS.  What we need to do is instruct Visual Studio to perform an additional build command for your project.

Right-click on the project and select the project properties.  Then from here choose the Build Events tab.  If you really want only a v2 build of your app, then in your post-build event you can enter this (obviously changing to the file name you created in Step 3:

   1: $(MSBuildBinPath)\MSBuild "$(ProjectDir)SilverlightApplication1_2-SL2.csproj"

And when you F5 you’ll end up with a Silverlight 2 XAP.  Go ahead and look at the generated AppManifest.xaml file…it will show you RuntimeVersion=”2.0.31005.0” in the file.

What just happened?

Basically when you F5 in Visual Studio in projects, you are initiating build commands.  Sometimes you’ll see that it just uses csc.exe, but basically these are all build commands in the system.  What we’re doing in Step 4 is telling Visual Studio: When you’re done with that, go ahead and execute this additional build command for me, kthxbye.  Some may look at this and ask if 2 builds are happening.  The answer is YES.  Issuing a build command in VS does its normal process and then we are OVERWRITING THE OUTPUT with our second build.

NOTE: If someone has a better way to tell VS don’t do your normal build but do this instead please post in the comments…I’m not a VS build system pro.

You are definitely overwriting your SL3 compiled bits with the new ones.

Can I build both SL2 and SL3 from the same base?

Sure.  You’ll have to modify the OutputPath setting for your projects so they don’t overwrite each other.  I’m sure if you are asking this question you have a good reason for it as SL2 apps are compatible running under the SL3 runtime without needing to recompile.  I modified my VS IDE app on the Build tab (in the Properties dialog) to put the output in an SL3 folder.  I then modified the OutputPath setting in my file from Step 3 to a folder called SL2.  Now when I build in VS I get both binaries/XAPs created:

post build directories

So I can do what I want with the XAPs now.

So, what’s the catch?  Isn’t this multi-targeting?

Big catches…and NO, this isn’t multi-targeting for VS2008 (at least what we define it for Visual Studio).  Here’s the catches I’ve found:

Your IDE is still a Silverlight 3 IDE environment.  What I mean by this is that VS is doing nothing to prevent you from writing Silverlight 3 code.  Intellisense will be targeted at the SL3 SDK you have installed.  This means if you aren’t paying attention and don’t know what APIs aren’t available in SL2, you can get into trouble VERY fast.  In this event, if you do add code that is SL3 specific your SL2 SDK MSBuild will error out and report back in VS.  Here’s an example of where I added some element-to-element binding in my XAML and VS reports the error for the post-build event (as reported in the Errors output window):

   1: Error    2    The property 'ElementName' does not exist on the type 'Binding' in the XML namespace 'http://schemas.microsoft.com/winfx/2006/xaml/presentation'.    C:\Users\timheuer\Documents\Visual Studio 2008\Projects\SilverlightApplication66_3\SilverlightApplication1_2\MainPage.xaml    10    61    SilverlightApplication1_2
   2: Error    3    The command "C:\Windows\Microsoft.NET\Framework\v3.5\MSBuild "C:\Users\timheuer\Documents\Visual Studio 2008\Projects\SilverlightApplication66_3\SilverlightApplication1_2\SilverlightApplication1_2-SL2.csproj"" exited with code 1.    SilverlightApplication1_2

My SL3 build will still complete fine, remember the SL2 is a post-build event.

The other thing is copying files to an associated web project.  In my steps above, the XAP that would get copied to the ClientBin directory of the web app was the SL3 version.  Honestly I didn’t take the time to worry about that and I know that you could get more creative with your build command to change that…but I wanted to be clear about the output of my steps outlined here.

Assembly references will be another issue.  Remember, VS is doing nothing to prevent you from doing things SL3-specific.  So the assembly reference list you see will include SL3-specific binaries.  Also when you add references in VS, it alters the **proj file.  So each time this happens you’d have to manually edit your copied file to make sure the references are there and are the correct ones for the SL2 SDK.  This can get messy very fast.

What if I just want to continue doing Silverlight 2 development, but view SL3 sites?

Well, then I need to come over there and talk to you about the aweseomeness of Silverlight 3!  But if you must, let me let you know what is going on here.

Short answer: don’t install the SL3 tools.  But again, you’re crazy right?  Silverlight 3 is awesome!

Longer answer…

The Silverlight 2 Tools installer now installs the Silverlight 3 developer runtime, but still installs the SL2 SDK.  Confusing huh?  Bottom line is that in this configuration you can develop SL2 apps in the IDE (with SL2 Intellisense, assembly references, etc) but still be able to view SL3 sites out on the Internet.  How is this possible?  Because the SL2 tools are using the build commands and VS hooks for SL2 SDK (look at the project file and you’ll see it is like above in Step 3).

If you have SL2 tools already installed but don’t have SL3 yet…you cannot install the end-user SL3 runtime on top of a developer runtime (i.e., you cannot ‘upgrade’ a developer runtime to a non-developer runtime).  So you’ll want to install the SL3 developer runtime on top of your SL2 environment in this situation.

Summary

I do not by any means consider this guidance from the Silverlight team.  This is, in fact, a hack.  It’s unsupported, might not work for your situation and as Scott Hanselman says, it may hurt baby kittens.  This information is merely here to really prove a point that you can use MSBuild to build Silverlight 2 applications with the Silverlight 2 SDK.  That’s really the end output here.  The rest is hackery to get VS to do things with that build.  I firmly recommend you develop using Silverlight 3 anyway!

Use at your own risk.  If there are other MSBuild professionals out there that have better methods than post-build events, please comment – again, I’m not a pro in that area, so this was my first pass at testing this out based on questions I got from the community.

Hope this helps and don’t blame me for any injured baby animals.


This work is licensed under a Creative Commons Attribution By license.

| Comments

Over the past year Sara Ford had created a Visual Studio tip-of-the-day feature of her blog that eventually was aggregated pretty much everywhere and also in the Visual Studio community page displayed within the product itself!  The tips were plenty and great…a ton of gems that you may not have known before and a subtle reminder that there is so much more to learn.

This year Scott Cate has decided to take this one step further.  He’s begun taking this tips concept and providing actual walk-through and visual demonstrations of these tricks.  One thing that I really like about this approach is that while I may skim through the text of a tip and thing “that’s interesting” I may never actually put it in practice because it’s only in text and not visual.  Seeing them in video helps me see the immediate value of taking the time to learn the tip and put it in practice and/or validates that the tip isn’t going to be helpful to how I use the tool.  If you’re a Visual Studio user, fire up a subscription to Scott’s VSTricks feed to get the videos and see what you’ve been missing (oh and a shameless plug that he’s chosen to use Silverlight to display the videos)!

| Comments

Whew, we made it!  Silverlight 2 is now released (and available for download)!  (Official press release here.)  I know we’ve always said “by the end of the year” but the team has worked really hard to get Silverlight 2 released well before then so you can start building and deploying your applications.  A lot of people don’t realize that “Silverlight” is actually a team of many that make up the runtime, media, tools, controls, etc. teams.  Hats off to all those involved who pushed hard to get Silverlight 2 out the door (and are already working on the next version)!

So, on to the release…(long post)

What you need and Where to get it?

The Silverlight community site should be your definitive source as a developer.  All of the tools you need are located on the Get Started section of the site and include:

Really as a developer using Visual Studio 2008, all you need to download is 2 things: Silverlight Tools for Visual Studio and the Blend 2 SP1 bits.  The Silverlight Tools installs:

    • The latest Silverlight 2 developer runtime (Windows) – so you don’t need to download this in advance unless you need to do some offline installation of sorts.
    • VS Tools
    • VS Silverlight Project Templates
    • SDK documentation for integrated help
    • SDK (non-core) Controls (DataGrid, Date controls, Tab controls)
    • ASP.NET Server Controls (asp:Media and asp:Silverlight)

The requirement to install the Silverlight Tools is that you have to have Visual Studio 2008 SP1 installed.  If you are a Visual Web Developer Express user, these tools work for you as well!  You still have to have SP1 of VWD Express, but you can install these tools to developer Silverlight applications.  So you can have a free development tools environment for Silverlight with Visual Web Developer Express 2008 SP1 and Silverlight tools!

Also keep handy the Breaking Changes document.  While we hope you took advantage of the RC0 build to prepare your applications, we still want to make sure those that didn’t have the information available.  As a reminder, Beta 2 applications will not work on the release runtime of Silverlight 2.

Any other tools to develop Silverlight applications?

Other than the awesomeness that is Visual Studio?!  Actually Microsoft is continuing it’s commitment to Open Source in the developer group.  To that end we’ve done a few things you might find interesting with regard to Silverlight 2.  First, we’re funding a venture to provide Silverlight tools for Eclipse.  We’ve partnered with Soyatec who is an Eclipse Foundation Member based in Paris, France.  The Eclipse Tools for Microsoft Silverlight describe the project as:

“The purpose of this project is the creation of open source tools integrated with the Eclipse development platform that enable Java developers to use the Eclipse platform to create applications that run on the Microsoft Silverlight runtime platform. Specifically, the project will be an Eclipse plug-in that works with the Eclipse Integrated Development Environment (IDE) and Eclipse Rich Client Platform (RCP) to provide both a Silverlight development environment and greater interoperability between Silverlight and Java, to facilitate the integration of Silverlight-based applications into Java-based web sites and services. The project has been submitted to the Eclipse Foundation and released as an open Eclipse project.” – source: http://www.eclipse4sl.org

I think this is pretty cool to see this level of involvement for this tool.  It looks like you’ll be able to do a lot within the Eclipse IDE if that is a tool you are more familiar with.  You can follow their progress at the Eclipse4SL blog and here from Steve Sfarz who helped initiate this effort.

The second thing we’re doing via our Open Specification Promise is to make available the Silverlight XAML vocabulary.  We’ve done this with WPF XAML already and this is a great addition to enable other tool vendors and technologies to extend their applications to read/write XAML for Silverlight.  I know Inkscape has already done this, and I hope that this released specification actually enhances their reliability in XAML generation.

So what’s new in Silverlight 2?

Aside from general improvements, bug fixes and optimizations, there are a couple of cool things to be noted about the Silverlight 2 release runtime.

Text Rendering – a lot of improvements went into overall text rendering.  This is an area that we will continue to improve and focus efforts.  The Portable User Interface font (default font if no FontFamily value is provided) looks a heck of a lot better in my opinion.

Controls

Some great stuff for the control freaks in us all.  When Beta 2 was released, we provided a bunch of core controls.  The core controls are still there in addition to the newly provided (since RC0) controls of PasswordBox, ProgressBar and ComboBox.  I’ve seen a couple questions about a few things so let me elaborate a bit on some of these new controls and the functionality of the controls.

First, ComboBox: why is it called ComboBox if it only has DropDownList features?  Great question.  One of the things we did with the release is try to bring greater compatibility with Windows Presentation Foundation (WPF).  Here is an example of that area.  WPF has a ComboBox, so when we added one to Silverlight we chose to be compatible (initially naming-wise and at the API level for certain functionality) with WPF.  Even though in this iteration it only acts like a DropDownList, it allows us flexibility and ease to update to greater compatibility in the long run.  PasswordBox is another such example.  You might ask why did you add PasswordBox but remove WatermarkedTextBox as I did.  Again, this is for WPF compatibility.

The core controls also got a facelift on the default styles.  The new styles are much more neutral (no blatant bevel reflector thingy that didn’t scale well).  Of course if you don’t like them, you are free to customize your own styles and control templates and Blend 2 SP1 enables you to do this with ease.  These style changes also brought capabilities more inline with WPF compatibility.  As an example, the following line is seen side-by-side with WPF on the left and Silveright on the right:

   1: <Button Width="125" Height="50" FontSize="24" FontFamily="Arial" Content="Click Me"/>
WPF sample button Silverlight Sample button

In addition to the core controls, the SDK basic control set (DatePicker, Calendar, GridSplitter, and TabControl) also benefitted from the style updates.  I think the most notable are the DatePicker and Calendar:

Silverlight DatePicker and Calendar

The controls like this also honor client culture settings, as you can see here by not changing any code, and changing my culture settings to fr-fr:

French DatePicker and Calendar

And wait, there’s more!  The DataGrid, which ships as an SDK control in a different assembly, got a pretty good overhaul with better styling, built-in sorting, and the ability to move columns around, etc.

DataGrid

If you are developing controls for Silverlight 2 and you already had some stuff working in Beta 2, please be sure to read the breaking changes document.  As a control vendor, probably the first thing you are hitting is that generic.xaml is now being looked for in a folder called “themes” at the root of your application, instead of the file itself being at the root.

Networking

Absolutely!  A few good nuggets I’d like to share.  First, how about being able to call secure (SSL) services from a non-secure hosted Silverlight XAP?  Booyah, we finally added that in.  The service endpoint must specify a policy (via clientaccesspolicy.xml at the root of the endpoint domain) to enable this, but once done, your XAP hosted in a non-SSL HTTP instance can call an HTTPS-based service.  Here’s an example of what that policy might look like on a secure SOAP service at https://foo.com/services/foo.svc:

   1: <?xml version="1.0" encoding="utf-8" ?>
   2: <access-policy>
   3:   <cross-domain-access>
   4:     <policy>
   5:       <allow-from http-request-headers="SOAPAction">
   6:         <domain uri="http://*"/>
   7:       </allow-from>
   8:       <grant-to>
   9:         <resource include-subpaths="false" path="/services"/>
  10:       </grant-to>
  11:     </policy>
  12:   </cross-domain-access>
  13: </access-policy>

In addition, the policy file was expanded to allow wildcard subdomains (i.e., http://*.mydomain.com) for the allow-from domain nodes.

Who wants some ADO.NET Data Services support?  You officially can have it now.  And no more dropping to a command line even!  If you have an ADO.NET Data Services (the artist formerly known as Astoria) endpoint, in your Silverlight 2 project you can choose Add Service Reference and point to that endpoint and the appropriate proxies will be generated for you.

Networking is an area that we also will continue to improve over time as future versions of Silverlight are already being worked on.  It is an area that we continue to get great customer feedback on and are evaluating and prioritizing.  Trust me, the networking team would love to implement all ideas yesterday, but of course these things take time and planning to do them right.

Are there more Controls?

If you haven’t read Shawn’s post about his teams plans for controls, you should.  Microsoft will be shipping the Silverlight Control Pack (SCP) under the Ms-Pl which will enable developers to learn from and extend if needed, but also to learn how to create great controls for their applications as well.  The controls will support the Visual State Manager where appropriate, thus making them work well with both Visual Studio as well as Expression Blend 2.  Some of the controls announced are:

    • DockPanel, ViewBox, TreeView, Accordion, AutoComplete…and more will come.

The first set of these will likely be made available as Shawn indicates during the PDC 2008 timeframe for developers to start consuming.  You can start seeing some previews of these controls from Justin Angel, a member of the team.

Additionally, the SCP will also provide new control template styles for use in the SCP controls and adaptation for use in other controls in Silverlight.

What’s new in Blend 2 for Silverlight 2?

Other than the obvious of supporting Silverlight 2 projects officially, the SP1 for Blend 2 (notice there is no longer a Blend 2.5 for this release, but rather just a SP1 to Blend 2; so to clarify: Blend 2 + SP1 = Blend 2.5 June Preview[updated]), there is a few good gems in the update.  Here’s one I particularly like: font embedding support.

In Blend 2 SP1, you can choose a custom font from the picker.  It no longer only displays the Silverlight core fonts, but also your machine fonts.  The Silverlight core ones will be decorated with a little Silverlight logo as seen here:

Font selection showing Silverlight icon

If you select a font that is not a part of the core, you’ll be warned in Blend and given options of what to do.  Blend 2 SP1 now includes a font manager that will enable you to embed the selected type using Static (only the characters represented in the text at the time of choosing it) or Dynamic (the character set that would enable text changing and the font still being in tact:

Font Manager in Blend 2 SP1

Of course VisualStateManager features are still awesome and still there!  Be sure to check out Jonas Follesoe’s Colorful add-in for Blend…very cool for us color challenged.

What will my users see if they have Silverlight vX installed?

We’ve greatly improved the ability for developers to understand where their users are coming from (with regard to if they have the plug-in, what version, etc.) and provide the best possible user experience to that user base.  I plan on detailing out these steps in another post, so please consider subscribing to my RSS feed if you haven’t done so and you’ll see that update shortly.  These steps include providing guidance, samples, and new API information for plug-in error codes that will help your installation experience.

How do I upgrade my Beta 2 application?

The best advice I can give you with regard to upgrading your application is two things.  First, get the breaking changes document and keep it handy.  Next, open your project and try to run it…pay attention to the warnings/errors in Visual Studio and cross-reference with the breaking changes document.  Seriously, that’s the best method is to just start getting dirty.  Spending a lot of time guessing what you need to change won’t help you if you still guess wrong :-).

What about Silverlight Streaming?

Silverlight Streaming will be updating their support to Silverlight 2 (release) soon.  Please subscribe to their blog for continued updates.

What about debugging on a Mac?

Updated information about using the Mac developer runtime and performing remote debugging is in the SDK.  It provides you with the steps that will be required on both machines to ensure proper debugging techniques.  Ideally this wouldn’t be needed because of the nature of how Silverlight 2 runs cross-platform on both Windows and Intel-based Macs.  My colleague Peter Laudati has some great experience in setting this up and you can see some of his insights on his blog.

Mac OSX debugging

What about the videos, tutorials, etc. on Silverlight.net?

The content team that helps manage the Silverlight community site has been going through samples and doing our best to find some of the more significant changes and updating the code.  The actual video content in most cases won’t be updated, however the code downloads (provided in both C# and VB) will be updated in some cases.  Most of the time I’ve seen the basic upgrade issues of needing to re-reference things like the System.Web.Silverlight assemblies for the ASP.NET Silverlight controls.  We are also planning on producing some new release samples for your pleasure as well as some new features on the site.  Again, I’ll go into more detail about those in a future post shortly, please subscribe.

Summary

Silverlight 2 releasing represents the end of a lot of hard work for a lot of people at Microsoft.  Hats off to them for getting to where they have gotten and providing a great rich platform for developers to build interactive applications for the web.  I know that all the program managers have put in a lot of time for this release and listened to a lot of feedback from customers and community.  They’ve had to make tough decisions along the way, but have produced a great release for developers.  They’re already working on some stuff for the next version of Silverlight (you are going to PDC aren’t you?).

With the refinement of controls, the addition of the Silverlight control pack, the announced support for Eclipse, and the benefit of using the .NET Framework in the browser, Silverlight is providing to developers to be a solid platform to start building their applications on for their organizations, whether it be internally or public-facing.

So what are you waiting for?  Go on and get started so that you can begin enjoying what Silverlight 2 has to offer you!

| Comments

If you live in the WPF world, you may know the name of .  If you’ve heard the name, but just not have met the man…next time you’re at a developer conference, look for the guy in the Hawaiin shirt, shorts, some ink on the arms and is probably passionately talking to some other geeks about the innards of data binding in XAML.

Recently, Karl has joined Microsoft to work on the “Cider” team.  The Cider project is a key part of the developer story for WPF and Silveright.  It is the XAML designer/editor/etc for Visual Studio.  Some of you may know Karl from his work on his pet project, Mole.  Well, Karl is at it again.

He’s been working on another project called .  What is it?  In his own words:

“XAML Power Toys is a Visual Studio 2008 SP1 Multi-AppDomain Add-In that empowers WPF & Silverlight developers while working in the XAML editor.  Its Line of Business form generation tools, Grid tools,  DataGrid and ListView generation really shorten the XAML page layout time.”

The goal of this Visual Studio add-in for WPF and Silverlight is to enable developers to quickly layout and maintain business application forms using the UI controls that are a part of the XAML frameworks.  Here’s a list of the features:

    • Create WPF or Silverlight DataGrid For Class - quickly create a WPF DataGrid complete with bindings that are easily associated with properties on the source class
    • Create WPF ListView For Class - quickly create a ListView complete with bindings that are easily associated with properties on the source class
    • Create Business Form For Class - quickly create a form complete with bindings that are easily associated with properties on the source class
    • Create Business Form - quickly create a form complete with bindings if desired 
    • Show Fields List For Class - display a list of class fields similar to Microsoft Access.  Allows dragging of fields to create controls
    • Group Into - allows selecting one or more controls and group them inside a new parent control
    • Chainsaw - Minimize Cider Designer XAML - allows selecting of one or more controls and will remove all MinWidth, MinHeight, x:Name, Name, Margin properties and will set all row and column definitions to Auto.
    • Remove Margins - allows selecting one or more controls and removes the Margin property from them
    • Edit Grid Column and Rows - allows selecting a grid and then add or remove rows and columns
    • Set Defaults For Created Controls - allows customizing the initial properties that are set when the software creates a new control

Want to layout a quick form based on a business object, how’s this for a start to help define what the form should be:

After you click create, you just paste the results where you need the form/grid in your XAML and it’s done for you!

Karl has created 8 videos walking developers through the aspects of XAML Power Toys and strongly encourages every XAML Power Toys user to view the videos before you get started.

A *very* cool utility for WPF and Silverlight developers.  Please, please do view the videos that Karl has created…they are short and to the point and helpful to get you understanding some things!  Check out XAML Power Toys!

| Comments

Today we released Silverlight 2 RC0This release is for a very specific purpose and although the information will likely be repeated, I wanted to try to help answer a few questions.

What is this release?

RC0 is a developer release only!  The intent of providing these bits is to provide developers with ample time to have access to the release candidate runtime/controls for Silverlight with the primary goal of making sure that developers with Silverlight 2 Beta 2 applications that are live today prepare for the release of Silverlight 2.

What should a developer do?

If you have a Silverlight 2 Beta 2 application that is out there today, you should use this RC0 build to port/stage your application in a test environment to this RC0 build and test to make any required changes based on the breaking changes from Beta 2 to RC0.

Why should I care?

Because your Silverlight 2 Beta 2 applications will not work on the release of Silverlight 2.  If you have applications today, you want to make sure that your application will work and that is why we’re providing this RC0 build for developers now.

I’ve made my changes and it works, should I deploy it now?

NO!  This is a developer release only.  What does that mean? That means that there is no end-user installable runtime that is released, only the developer runtime with the developer tools.  If you deploy an RC0 application into the wild your users will be greeted with unfriendly install messages taking them to bits for Beta 2, making them confused.  You should, however, deploy to your test environments for your test team(s) to check out your application.

So why am I doing this again then?

Sorry to be repetitive, but this is for developers.  Again, the goal is to give developers who have Beta 2 applications ample time to port/stage and test their applications.  You want to do this to be ready so that when Silverlight 2 releases, your app will be ready and you can flip the switch on your bits.

Will my end users be auto updated to RC0?

No, end users who have either Silverlight 1.0 or Silverlight 2 Beta 2 installed will not be automatically updated to RC0.  When Silverlight 2 releases, they will be notified of a new version for the release version.

So how will I know what may break?

We’ve created a breaking changes document that provides the breaking changes between Beta 2 and RC0.  It is available for you to download and we recommend you use this as your guide and first point of attack when troubleshooting porting your application.  The breaking changes document is located here.

As an example, here’s one that I think is so simple, but might have some banging their heads when their users complain they are still being asked to install Silverlight.  In the Beta 2 builds, if you use the <object> instantiation method, your code may look something like this:

   1: <object data="data:application/x-silverlight," type="application/x-silverlight-2-b2" width="100%" height="100%">
   2:     <param name="source" value="ClientBin/XMLFile.xap"/>
   3:     <param name="onerror" value="onSilverlightError" />
   4:     <param name="background" value="white" />
   5:     
   6:     <a href="http://go.microsoft.com/fwlink/?LinkID=115261" style="text-decoration: none;">
   7:         <img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none"/>
   8:     </a>
   9: </object>

In RC0 (and release) you’ll want to change it to this:

   1: <object data="data:application/x-silverlight," type="application/x-silverlight-2" width="100%" height="100%">
   2:     <param name="source" value="ClientBin/XMLFile.xap"/>
   3:     <param name="onerror" value="onSilverlightError" />
   4:     <param name="background" value="white" />
   5:     
   6:     <a href="http://go.microsoft.com/fwlink/?LinkID=124807" style="text-decoration: none;">
   7:         <img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none"/>
   8:     </a>
   9: </object>

Notice the type attribute in the <object> tag changes from application/x-silverlight-2-b2 to application/x-silverlight-2.  Please note this is the plugin application type only and not to be confused with the server-side MIME type mapping (which should be .XAP mapping to application/x-silverlight-app).

Also notice the correct link to the “fwlink” to the runtime.  When Silverlight releases you’ll be sure in your custom install experience (please don’t use the default) you’ll want to point to the right link.

Ok, I’m convinced, what do I need to do?

Here’s what I’d do if I had a beta 2 application:

    • Re-read the above to make sure I understand the intent of this release fully.
    • Download the Silverlight Tools for Visual Studio 2008 (RC0) – this will give you the VS project templates, the VS updates required, the RC0 developer runtime and the SDk documents.
    • Download the Expression Blend 2 Service Pack 1 Preview – this build of Blend is targeted against the release bits of Silverlight and will help you in porting your application.
    • Make sure you have a backup of your project (or set a version/tag/branch in your source control) so you can rollback if needed.
    • Open your Silverlight project using the updated tools.  You’ll see a note about the project needing to be upgraded.
    • Compile/run your application and pay attention to any warnings/errors that the compiler/Visual Studio spit out.
    • Compare/contrast any warnings/errors with the breaking changes document and modify if needed.
    • Put your application in a test environment only for your developers/internal testers to mess around with.  Do not deploy your application to your customers yet!
    • Rinse.  Repeat.  The testing/changing cycle that is.

This should get you going rather quickly.  If you experience issues, use the appropriate feedback channels that you’ve already established (i.e., if you are working with someone at Microsoft or have a contact).  Please be sure to consult the breaking changes document first though.

Allow me to comment about breaking changes.  I know that as a developer this can add work for you…ah the joys of being an early adopter!  Breaking changes in beta to release products can be a good thing if it helps bring compatibility in frameworks and if it makes for an easier or more logical API.

Okay, so we do all this prep work, when is Silverlight 2 releasing?

Ah, the magic question.  While we aren’t providing any dates right now, we are still committing to shipping Silverlight this year.  We are providing this release now to ensure you as a developer can stage/test your Beta 2 applications and be ready!  If you don’t have any applications that are running now (live) on Beta 2 but have been working on one, then you’ll want to start with RC0 as well so that you minimize the work you have to do when you go live.

Other goodness

The ADO.NET Data Services (the artist formerly known as “Astoria”) bits are also updated in RC0 SDK/Tools.  The bits that were provided as a stop gap are now a part of the RC0 bits.

Need the Mac developer runtime for testing?  You can get that here.  Also keep in mind this is a developer build as well.

What’s new you say?  Well not a ton (as we’ve been saying) but you should see a ProgressBar, PasswordBox and ComboBox in there now!  In addition to the new controls, all the controls were updated with new skin templates.  Also the RC0 bits allow you to enable HTTP hosted applications to call secure services (policy file required), which I know people have been wanting.  Wondering about stuff that Shawn mentioned?  Well you shouldn’t have expected them here for 2 reasons.  First, they aren’t going to be a part of the core runtime.  Second he mentioned that they are working toward a preview release for PDC (end of October).  So be on the lookout for that work!

I hope this helps!  Again, this information is also linked here and you can see some more notes from ScottGu here.