Mono.Mozilla on Windows

on Wednesday, September 26, 2007
Alexandre Gomes posted on his blog his experiences getting Winforms+Mono.Mozilla building and running on Windows.

First of all, I'd like to thank him for taking the time to try this out; I'm building regularly on Windows and I try to keep things simple, but things do always slip past unnoticed (especially when trying to keep linux, win+vs2k3 and win+vs2k5 in synch), so it's great to have an external pair of eyes looking at your stuff :)

He had some problems getting things up and running, so I thought I'd leave some pointers to help out those who want to test this out on Windows. Do check out his post so it's easier to follow along.

Building

You don't need the whole mozilla shell to setup the headers, the only thing you need is
  • the xulrunner sdk
  • xpidl.exe (from the xulrunner sdk)
  • libIDL-0.6.dll and glib-1.2.dll (from the wintools zip)
There's now a make.cmd on the "build" directory that does the same as the Makefile, so the steps are:
  • unzip the xulrunner sdk somewhere
  • put xpidl.exe and the two dlls in the build directory
  • open a command prompt, go to the build directory, and run "make [path-to-xulrunnersdk]".
In the include and linker configurations, you only need to point to your newly created build\include and build\lib, respectively. These contain everything that is in the sdk plus the extra header files.

The missing nsAppDirectoryDefs header has been added, so you don't need to google for it anymore. Ooopsie :)

Running:

To run an application, you always need to have in the same directory:
  • the contents of the xulrunner runtime package
  • your app's exe :)
  • the mono.mozilla dll
  • the xulbrowser.dll
If you want to have the runtime in a different directory, you'll need to first register it: in a command prompt, go to the xulrunner runtime directory, and run "xulrunner.exe --register-global".

Then, on the build directory, run "setup-runtime.cmd [path-to-your-application-exe], which will create some directories that are required to be where your app is.

Other problems
The browser problems mentioned (unable to input text) have been fixed, so the latest version should be fine.

The Mono.Mozilla project is also fixed.

As for the TortoiseSVN problems, I use tortoise for all my work and it's always worked great :p
Of course, I've never used the _svn variant, it's too much trouble and incompatibility just to have svn with webapps on vstudio. I suggest using the regular version for fun and happiness :)

Thanks again to Alexandre, and do nag me if anything goes wrong.

5 comments:

duff said...

to maintain VS 2003 & 2005 solution why not used dnpb ( http://sourceforge.net/projects/dnpb/)
it is an project generator with a basic XML whitch can take all file with filter (*.cs) in a folder.

andreia|gaita said...

@duff

Interesting project, didn't know it, thanks for the pointer.

From what I can tell, though, it won't be much use - the projects I'm using are VC++ projects, not VCS, and I need to have a Makefile in synch, also.

In the future I'll probably automate the project and makefile creation with some scripts. For now, though, I'll just have to be careful :)

zbowling said...

As always, for everything you have done with this library, I love you to death! :-)

Zvi said...

hi andreia,
Can you update on the state of the control?
First, I can't find the mozembed directory on anonymous snv. Second, I was able to run the UsingWebBrowser-port sample with mono 1.2.6 on windows out of the box (although it crashes when resizing the window) without the required xulbrowser.dll. How come?
Last, are you planning to support the two-way communication WebBrowser control <-> Javascript on page?

Thanks,
Zvi.

andreia|gaita said...

@zvi

Hi there. Yes, I should blog about the thing again :)

The library is now called gluezilla, and resides on /trunk/gluezilla.

1.2.6 works because it included it on the installer, although yes, there was a big problem on resizing, which has been fixed since.

As for the js, depends on what the winforms api requires for support and how much I'll need to provide on the bindings, haven't reached that stage yet so haven't thought about it. It's possible :p