De Tout Et De Rien

To content | To menu | To search

Friday, December 18 2009

AddDependentFiles Addin updated for Visual Studio 2008

I have update my Visual Studio adding named "Add Dependent Files" (See the original entry). It is available for download here.

Wednesday, April 29 2009

Monobjc supports SM2DGraphView framework

Monobjc 2.0.342.0 was released on April 2009, the 15th. One major addition in Monobjc is the support of SM2DGraphView graphing framework. It is the first round to include a graphing framework, and I hope to enhance the support in the next releases.

Sunday, December 21 2008

Sparkle support in Monobjc

Monobjc 2.0.313.0 was released on December 2008, the 17th. One major addition in Monobjc is the support of Sparkle update engine. Sparkle is one of the most used framework in the Cocoa world, as it makes updating an application a breeze. The main problem with Sparkle in Monobjc was the private framework embedding. With Sparkle, updating a Monobjc application has never been so simple. Check out the tutorial for Monobjc and Sparkle.

Saturday, December 13 2008

Monobjc with Delphi Prism

I am pleased to see that Monobjc can be now used with Delphi Prism thanks to RemObjects Software. Marc Hoffman has a nice blog entry about this integration.

Thursday, November 13 2008

<mkbundle/> task in Monobjc

Many people want to package their .NET application for Mac OS X. And above all, they want the experience to be painless, which means that they want to ship an application that runs, whether Mono is installed or not.

The process of packaging a .NET application for Mac OS X basically follows 4 steps:

  • Getting .NET dependencies of the .NET executable
  • Generating a native loader that will embed all the .NET assemblies (.NET executable and .NET dependencies)
  • Getting native dependencies of the native executable
  • Relocating all the stuff so library loading goes well

The process can be even more complicated if you are using reflection, dynamically discovered library and so on. So let's keep thing simple.

Getting .NET dependencies

This is the easy part. You just have to find recursively all the .NET dependencies of the .NET executable. As every .NET assembly contains its references, it is trivial.

Generating a native loader

The native loader generation is simplified by the fact that Mono allows .NET assemblies to be loaded from embedded binary streams. So for every .NET assembly, we generate a binary array and use the magical functions of Mono. If there are configuration files to embed, the process is the same.

Getting native dependencies

Once the native loader is compiled, the otool command can give us all the native dependencies. So we gather all the native library needed to run our application. But on Mac OS X, the dynamic loading is based on paths recorded in each native library. This is the point of the next step.

Relocating all the stuff

This is the tougher part of the packaging. Now that you have all the native dependencies, you must be sure that you only have unique dependencies. Why, because we you gather dependencies, you can find either specific version of a library or compatibility version of a library. Failing to make these reference unique can lead to unexpected behavior (mostly cryptic crashes). That where the otool command is useful as the first line always contains the specific version of a library, even if run against a compatibility version symbolic link. Then the install_name is used to change absolute path to relative path containing the macro @executable_path.

Packaging made easy

All this steps can be tedious and error prone. That's why, in the Monobjc, the packaging is done by a NAnt task: <mkbundle/> (you can find its options on this page). This task can handle most of the need for .NET application packaging in a truly simple way. And as a bonus, this task is not linked to the Monobjc bridge, so you can use it even if you don't use the Monobjc bridge.

Sunday, September 14 2008

Future of Monobjc

Monobjc is more than one year old, and the time has come to go beyond the Monobjc bridge. In order to develop the .NET programming on Mac OS X, a bridge is not enough. A whole development ecosystem is needed, so any new developer will have all the necessary tools to leverage the power of .NET on Mac OS X. I have identified several tools needed when developing applications:

  • IDE: An IDE is great as it speeds up the edition on multiple document and centralized the application development (code writing, compilation and packaging). Unfortunatly, an IDE is a very complex machinery. Identified solutions: fork SharpDevelop or MonoDevelop.
  • Reflector: A tool like Red Gate Reflector is useful when dealing with assemblies. The though part is to write the IL reverse-engineering engine. Identified solution: a Reflector clone based on Mono Cecil.
  • Obfuscator: When distributing applications, obfuscation is an additional mesaure to protect your investment. Identified solution: an obfuscation tool based on Mono Cecil.

The ecosystem can also be completed by libraries either based on Mac OS X framework (Sparkle, Growl, ...) or existing .NET libraries. Stay tuned as now, the goals for Monobjc are clear.

Monday, August 11 2008

Raytracing with Mono on Mac OS X

A while ago, Luke Hoban implemented a ray-tracing sample application. I have made a Cocoa port of this application by using the Monobjc bridge, and it was over in less than one hour. Here is a screenshot:

Ray Tracer Application in Cocoa

You can download the source code as part of Monobjc.

Thursday, January 17 2008

Monobjc is alive (hourray)

After six month of casual development, I am pleased to announce the Monobjc project. The Monobjc project provides a .NET/Objective-C bridge that can be used to add the power of the Mac OS X API (Cocoa, CoreGraphics, WebKit, QuickTime, etc) to .NET application (thanks to Mono).

Thursday, February 1 2007

Add Link to a file in Visual Studio 2005

Maybe you have already seen that in some Visual Studio 2005 projects : a item that represents a link to a file (see image below).

A linked file

It is very handy to reference through a link a file : for example, if you have three projects that uses the same file, just put a link. But when I add item to my project, I cannot see a Link or a similar option. This is because it is a bit after. Here are the steps :

1) Go to the Solution Explorer

Solution Explorer

2) Select "Add an Existing Item"

Add Existing Item

3) Select the file to add and click on the arrow at the right of the button "Add", and click on "Add as Link"

Add a file as a link

4) In Solution Explorer, you see the linked file

The linked file

Friday, December 8 2006

Dependent Files under Visual Studio 2005

A nice feature of Visual Studio 2005 is the ability to group source files by dependencies. This is what Visual Studio 2005 does when it creates a Form class or a visual control : a dependent file named from the class name is created and linked to the primary source file (as shown in the picture below).

Dependent Files generated by Visual Studio 2005

Now imagine that you have a very complicated visual control with a lot of properties, methods and events. It would be nice to split all these things in tiny source files, to make the source code browsing easier (as shown in the picture below).

Dependent Files generated by the Addin

Unfortunately, there is no option do apply the same treatment to arbitrary files in the project. That's why I have created a Visual Studio 2005 Addin to allow dependent files for any arbitrary files. It is quite straightforward, but the result is a cleaner project tree and an ease of code navigation.

Here are the steps :

  1. Create the files you want to be dependent, like UserControl1.Properties.cs. I use this convention to mirror what Visual Studio does.
  2. Make sure the new file contains partial definition of the class. The partial definition is a new feature available in the .NET Framework 2.0.
  3. Open the master file. Select the Tools/Add Dependent Files menu. Select one or more dependent files.
  4. The selected files are now dependent of the master file.

Download the Add Dependent Files Addin.

- page 1 of 2