Friday, 15 March 2013

Packaging an O2 Platform Script as a stand alone tool (in this case the WatiN based ‘IE Script’ tool)

If you grab the latest version of the O2 Platform and try to run the IE Script tool

image

you might get a bunch of compilation errors, like the ones Arnaud described in this How to get a "full" version of o2  mailing list thread.

The best way to deal with this is to run this O2 Script as a ‘packaged script’, i.e. from a stand-alone exe that contains all dependencies required to run it.

The rest of this post shows how to create such stand-alone exe for the IE Script tool.

Open the Package O2 Script tool/script

image

which looks like this:

image

Then click on Find an O2 Script:

image

Search for IE Automation

image

And Drag-n-drop the IE Automation (Simple mode).h2  into the Drop Zone

image

The button should go green to represent an active build/package process

image

And look like this when completed (the button goes red if there are compilation or packaging errors)

image

That 3.084kb exe file is now our packaged script :)

You can run this executable directly from here:

image 

or copy it to another vm with .NET 4.0 installed

image

and run it from there:

image

In some cases (like this one), there will be two new folders created in the executable folder.

The O2.Platform.Scripts (containing the scripts dynamically compiled by the REPL)

image

And the O2.Temp (which will contain all temp files (including the O2 assemblies that were embedded in the stand-alone exe and extracted to facilitate the compilation))

image

Going back into the tool that created the stand alone script, the logs provide really good info on what happened:

image

and if you open the _BuildFiles you can see the VisualStudio project that was programmatically created and compiled

image

In fact, you can open that IE Automation (Simple mode).csproj file in VisualStudio

image

And run the tool (or a customized version of it) from there:

image

Note: I just uploaded the IE Automation (Simple mode) v1.0.exe tool to the O2 Platform downloads at Google Code, so you can also grab it from there:

image
Post a Comment