Chiron produces Silverlight application packages (XAPs) for applications using Dynamic Language Runtime (DLR) based languages.

Why is it needed?

Silverlight applications are distributed in packages, or XAP files, which are ZIP files with a few required files inside them. Because of this requirement, dynamic language applications require the DLR and language assemblies to be inside the package, along with all the other script files the application requires. These packages works great for compiled languages since they can do the packaging as a post-build step. However, dynamic languages are traditionally not compiled to disk, so we need something to make the XAP creation transparent.
  • Note: There is a "script/server" script which takes all the same command-line options as Chiron, essentially being a shortcut script for Chiron. It is preferred to use that for running the server as it will work both on Windows and Mac.

Dynamically generating Silverlight XAP files

The main usage of Chiron is to run it as a localhost web-server, and Chiron will automates the XAP file creation with every web-request.

Given this simple application:
Run Chiron as a web-server
> cd MyApp
> Chiron.exe /webserver
Chiron will launch a localhost-only web-server at http://localhost:2060 with the webroot being the current working directory. When it receives a request for "app.xap", it will look for a folder named "app", XAP the contents in memory, and send it back to the client.

This allows you to edit a file and simply hit refresh on their browser to see the change!

Generating XAP file to disk

Chiron's webserver is great for localhost access, but it only responds to local requests. Also, when deploying your application, the overhead of generating the XAP every time is not desired, so you'd want to generate the XAP file to disk. Silverlight applications can be hosted on any web-server if the XAP file is on disk.

So, with our same sample app:

> Chiron.exe /directory:MyApp\app /zipdlr:app.xap
This will XAP the app directory, generate an AppManifest.xaml if necessary, and insert the DLR assemblies and the language assemblies of the languages you used in your app.

Contents of XAP file

If you make a request for app.xap, it will contain these contents:
And here's what each piece represents:
  • app.rb - Entry-point script for this application, exact copy of MyApp/app.rb
  • AppManifest.xaml - Required for every Silverlight application: defines the assemblies required to start the application. Chiron generates this based on a template in Chiron.exe.config if it doesn't already exist in MyApp/
  • The .dll files added here are necessary for using the language(s) you use in your application (if they aren't already in MyApp/). Whatever languages you use Chiron will try to find the matching assemblies for them. This is configurable in Chiron.exe.config.
    • IronRuby.dll
    • IronRuby.Libraries.dll
    • Microsoft.Scripting.dll
    • Microsoft.Scripting.Core.dll
    • Microsoft.Scripting.Silverlight.dll


Chiron allows you to configure what languages it knows about and the AppManifest.xaml template by modifying Chiron.exe.config.

New languages can be added in the <languages> section as follows:
<language extensions="myext"
          languageContext="MyLanguage.Namespace.MyLanguageContextClass" />
Customizations to the AppManifest template go in the <appManifestTemplate> section.


Running Chiron without any command-line arguments will show you the available flags Chiron will accept.
    Microsoft(R) Silverlight(TM) Development Utility. Version
    Copyright (c) Microsoft Corporation.  All rights reserved.

    Usage: Chiron [<options>]

    General Options:

        Specifies directory on disk (default: the current directory)

        Specifies XAP file to generate
        Does not start the web server, cannot be combined with /w or /b

        Suppresses display of the logo banner

        Suppresses display of all output

    Dynamic Language Options:

        Like /x, but includes files needed for dyanmic language apps
        Does not start the web server, cannot be combined with /w or /b

      /w[ebserver][:<port number>]
        Launches a development web server that automatically creates
        XAP files for dynamic language applications
        Optionally specifies server port number (default: 2060)

        Launches the default browser and starts the web server
        Implies /w, cannot be combined with /x or /z

        Saves the generated AppManifest.xaml file to disk
        Use /d to set the directory containing the sources
        Can only be combined with /d, /n and /s

Last edited Aug 5, 2008 at 10:42 PM by jimmysch, version 3


No comments yet.