In this post I just gonna go through how to get windows 7 phone up and running with ironruby, most are taken from Tomas Matousek but I had to make some customization for it to work!
Installing the SDK
first of all you have to download the Windows phone 7 developer tools and install those, will take awhile.
and then the binarys from the same URL
Creating the Project
at the moment windows 7 phone need a C# project from were it executes the ruby code, so you have to,
File => New => New Project => Silverlight for Windows phone => Windows Phone Application
remember those binarys from Step 2, now we have to add references to those by,
In solution explorer right click on the reference folder and choose add reference
A dialog window pop up and there you will browse to “IronRuby 1.1.2 Binaries\Windows Phone 7\”
you can add all at once.
add text file to your project root directory and name it MainPage.rb.
then you have to right click on the MainPage.rb select properties file
set the attribute “Build Action” => “Embedded resource”
configure the enviroment
The constructor of the MainPage.xaml.cs file should look like this ->
On 3rd line from down
Stream codeFile =
replace “WindowsPhoneApplication3”.MainPage.rb to whatever your namespace is for your project.
the reason from step 4 for is to make the GetManifestResourceStream() to return a valid stream, elsewise when we create the Streamreader from the line below it will throw a somethingNullException🙂
Sample ruby code
# Set the titles
Phone.find_name("ApplicationTitle").text = "Hello World"
Phone.find_name("PageTitle").text = "IronRuby on Windows phone!"