Tag Archives: Silverlight

Silverlight 3

Today Silverlight 3 officially launched; so, I decided to cut-over to v3 from v2. Here’s what worked for me:

  1. Ensure that all browsers are closed before proceeding.
  2. Open the Control Panel to begin uninstalling older Silverlight 2-related software.
  3. Select “Microsoft Silverlight Tools for Visual Studio 2008 SP1 – ENU” and uninstall the older IDE integration.
  4. Select “Microsoft Silverlight 2 SDK” and uninstall the older SDK, which, in my case, was installed via the IDE integration installer.
  5. Select “Microsoft Silverlight” and uninstall the older runtime. In my case, I was running Silverlight 2 GDR 1 (2.0.40115.0). You can determine your current version, if need be, here.
  6. Since I didn’t have an older version of Expression Blend on my machine, I could proceed. If you have an older version (release of beta), you should remove it, first, then continue on here. Before you install please know that once you do, your machine now becomes a Silverlight 3 development machine. You cannot down-level target to Silverlight 2.
  7. Install Silverlight 3 RTW (3.0.40624.0).
  8. Install Microsoft Silverlight 3 Tools for Visual Studio 2008 SP1, which includes the Silverlight 3 SDK.
  9. Install the Release Candidate of Microsoft Expression Blend 3 + SketchFlow. (I was hoping for the final release of Blend today, but I’ll settle for this (60-day trial) RC (version 3.0.1921.0).)
  10. Upgrade your Silverlight 2 solutions to Silverlight 3 solutions via the upgrade wizard. Etc. Etc.

Since the web is already flooded with plenty of additional commentary and sample applications, I’ll stop here and keep it practical for now. However, I’m excited about this new release and have some ideas to pursue in Silverlight 3. Stay tuned… :-)

P.S. You may also want to download the HTML Help documentation for Silverlight 3.

Consuming DFS WSDL in Visual Studio

Earlier today I posted to EDN a new sample project that demonstrates consuming DFS web services directly from their WSDL in a Visual Studio 2008 environment. Right up front, I want to credit my colleague John Sweeney, who really should start blogging, with providing the original work contained in this sample. My subsequent contribution was mostly UI/UX-related. Thanks, John!

After downloading and extracting the sample to your local development machine, open the solution in Visual Studio 2008. The default code assumes that you’re running the DFS web services locally (i.e. IP 127.0.0.1 and port 8080). You should, of course, modify the IP address and port to match your particular development environment.

Main sample UI

The main intent of this sample is to demonstrate various ways to authenticate via DFS. It’s worth noting that this sample doesn’t cover single sign-on (SSO) support in DFS, nor does it cover WS-Security header-based authentication. Good demos to be certain…

As the user interface (UI) above tries to clearly state upfront, content repository (aka Docbase) name cannot be null or empty, regardless of authentication approach. Given authentication via ServiceContext header, user name and password cannot be null or empty. Given authentication via ContextRegistry runtime service, when token is null or empty, user name and password cannot be null or empty, and when user name and password are both null or empty, token cannot be null or empty.

One thing that is still a bit obscure in the current UI is that authentication via DFS can be a two-step or one-step process, depending on the situation. If you choose “Via ContextRegistry…” and a Context Registry token isn’t provided to DFS, two runtime service invocations will be made. In all other cases, there is one service invocation.

Assuming that your connection details are valid given your authentication approach, this sample will (a) retrieve a repository list, (b) retrieve cabinets, and (c) retrieve content (i.e. transfer MenuItemTemplate.ini to your desktop).

A previous direct-to-WSDL DFS consumer sample I posted, targeted .NET 3.0 and WCF "v1." This sample targets .NET 3.5 and WCF "v2" instead, along with support for Silverlight 2. It accomplishes this change via LINQ to XML (e.g. leverages System.Xml.Linq.XDocument instead of System.Xml.XmlDocument).

If you need to target this sample at .NET 3.0, in addition to adjusting the project build properties, removing the project reference to the System.Xml.Linq.dll assembly, and removing the System.Xml.Linq namespace declaration in ServiceContextHeader.cs, you’ll need to change the relevant code within OnWriteHeaderContents. For example:

  XDocument doc = null;
  using (StringWriter sw = new StringWriter(CultureInfo.CurrentCulture))
  {
      XmlSerializer xs = new XmlSerializer(typeof(ServiceContext));
      xs.Serialize(sw, serviceContext);
      doc = XDocument.Load(new StringReader(sw.ToString()));
  }

would become:

  XmlDocument doc = null;
  using (StringWriter sw = new StringWriter(CultureInfo.CurrentCulture))
  {
      XmlSerializer xs = new XmlSerializer(typeof(ServiceContext));
      xs.Serialize(sw, serviceContext);
      doc = XmlDocument.LoadXml(new StringReader(sw.ToString()));
  }

etc.

Although, it’s not currently employed in the sample, there is also code to add a ContentTransferProfile to the ServiceContext header.

As always, consult the DFS Developer Guide for complete details on everything that may be passed in the ServiceContext header.

I do expect that this sample will be incorporated into the DFS SDK and DFS technical publications content; however, I wanted to get this into your hands sooner rather than later. Cheers…