Useful tidbit for MonoDevelop users

Published on Wednesday, September 3, 2008

If you are developing a project in MonoDevelop and your solutions/projects are in the old MonoDevelop 1.0 format (mds/mdp files), you'll probably want to convert them at some point to the new VisualStudio 2005/2008 formats that will be the default format in upcoming versions of MonoDevelop (2.0).

They are well supported in at least MonoDevelop trunk right now, and switching your MonoDevelop 1.0 project layout to VisualStudio's layout means you can more easily develop on both Linux and Windows. This is a good thing for us working on Banshee (hint, hint).

MonoDevelop makes the conversion part fairly straight forward. Select your top level solution, right click it, and then Tools->Export. Select either VisualStudio 2005 or 2008. We're sticking with 2005 for now in Banshee since we only care about C# 2.0 at the moment. Choose an export directory, it'll be temporary.

Unfortunately, it gets a little hairy here, and I wish MonoDevelop had some sort of "convert in place" option (hint, hint, MD team). Open a terminal, change to the directory MonoDevelop exported the project hierarchy to, and run this:

PRJ_DIR=$HOME/svn/banshee; for x in $(find . -iregex '.*cs?proj$' \
-o -name '*.sln'); do cp $x $PRJ_DIR/$(dirname $x); done;

Set PRJ_DIR to the directory of your project containing the project or solution file you originally exported.

This will ensure the new VisualStudio project/solution files are overlayed properly. Now you'll have to add them to your version control and remove the old mdp/mds files.

$ find . -iregex .*.cs?proj$ -o -iregex .*.sln$ | xargs svn add
$ find . -iregex .*.mds$ -o -iregex .*.mdp$ | xargs svn delete

Hurray for having both runtime and build time environments cross platform! We're looking forward to having contributors from both camps in the near future. More on this to come!

Update: Lluis points out that MD can in fact convert in place if you set the output directory to be the original directory. This seems too obvious :-).