SDK doesn't work for Silverlight v2.0 RTM?

Oct 25, 2008 at 10:03 PM
I am attempting to create a Silverlight + Ruby application but have been failing at every single attempt.

1. The documentation for this SDK says that I should be able to create a new application with "script/sl" .. Well, when I type "sl ruby helloworld" it tells me that template "ruby" was not found.
2. Manually creating the app from the templates results in a Silverlight 2 beta 2 I have to use Visual Studio 2008 to create the proper index.html and dispose of the one from the SDK
3. Chiron's webserver hosts the wrong version of the Silverlight control
4. When building a XAP using /zipdlr I get a JavaScript exception catch indicating that the Silverlight application was built with the incorrect version of the DLR.

Ordinarily I wouldn't find any of this disturbing but the problem is that every single website that I've visited with instructions on how to get this SDK to work with Silverlight has not mentioned any problems with the 2.0 RTM release at all... despite massive inconsistencies in the command line tools between various betas and RC's and the incompatibility between the control itself.

If someone could point me to a clear, concise example of getting Silverlight 2.0 RTM+Ruby working in Visual Studio 2008 ... I would be ecstatic..despite the fact that I've just spent 6 hours trying to get this to work... 6 hours of my life that I'll never get back ;)
Oct 25, 2008 at 11:03 PM
Somehow I had some weird pathing problems. I deleted all of my old SDKs, completely re-installed everything, re-installed the 0.4 DSL SDK and now I can get a "Hello World" application. The only problem I'm having right now is that all the blog posts from people show Visual Studio 2008 doing Ruby syntax highlighting and mine doesn't... Is there some set of steps to get this to work that people aren't posting about?
Oct 25, 2008 at 11:23 PM
This could be related to the lack of samples... none of the samples actually show clicking a Xaml-defined button and responding to that click with Ruby code.

I can do the following in app.rb quite easily: do |sender,e|
   message.text = "you clicked the button"

But I have been unable to get the following Xaml to work:

<Button x:Name="myButton" Click="myButton_Click" Content="Click Me"/>

Is there some naming convention that Ruby needs in order to get this to work or some special way of defining the method in the app.rb class?
Oct 26, 2008 at 12:36 AM
Worthless? Thanks ...

You can't hook ruby/python events in xaml, it can only be done from
ruby code. This is because the xaml parser doesn't know about dlr-
defined methods, and xaml doesn't have a way to extend itself in that
fashion. SL 1.1 alpha shipped with this functionality, but it had to
be removed when we took the dlr out of the core.

When thinking about getting this to work again, the only option would
be to implement a xaml parser ourself and do a first-pass over the
xaml to bind the events.

Another way to get the same effect is to have a vb-like event hookup;
define a method based on the x:Name and event name, and it'll be
automatically hooked. Id like to implement the 2nd option. Thoughts?
Oct 26, 2008 at 12:45 AM
Ruby in Steel has a ruby project system for VS which gives you syntax
colorization. There's also a alpha out for ironruby integration, but
only for console/winforms. We'll be releasing the first version of our
own vs integration, which will include webforms and silverlight, but
for now ruby in steel is your best bet.
Oct 26, 2008 at 12:46 AM

Worthless was poor word choice on my part, I was too frustrated to post clearly. I said worthless because, from my point of view, it looked like the DSL SDK only worked on the beta and not the RTM version. I've had similar problems before so I just figured there was a drop that hadn't yet dropped.

I'm fine with rigging the events in Ruby code - now that I know this is the only way to get it done.

Thanks...and my apologies for the frustrated comments before. Getting Ruby working under Silverlight is a feat of ridiculous scale and hats off to you folks for getting it to work.