Posts tagged ‘MonoDevelop’

Monodevelop: Howto add a WinForm project and file template

I am running MonoDevelop 2.4 on my acer aspire one x150 netbook running Ubuntu 9.04 (Jaunty).

From time to time I needed to write and run little test applications in C#. As I am alsos running another PC with Visual Studio 2005 and 2008, I like these for providing me a WinForm template, so I dont have to start from scratch.

Unfortunately MonoDevelop does not come with a WinForm template and I searched the internet on how to extend the templates provided by MonoDevelop to add a WinForm template. Although I found some resources on how to add templates to MonoDevelop, none of them worked as described.

Adding a template by using addins directory

Some sources state you can add templates by creating two files within the MonoDevelop home dir. For example adding HelloTemplate.xpt.xml and MyTemplates.addin.xml to “~/.config/MonoDevelop/addins”. I tried this approach, but it did not work as a WinForm project template.

Adding a template by using a packed template

Similar to the previous attempt but using mdtool to pack the files:
mdtool setup pack addins/addin.xml -d:addins
and
mdtool setup rep-build addins
where you finally get a mpack file with your xml template files. Unfortunately this did also not work for project templates.

Adding a template to the sources and recompile

As I already had the MonoDevelop sources as I have compiled and installed MonoDevelop 2.4 from sources, I looked for the existing templates and added my WinForm project and file template.

Screenshot Start New WinForm project

Screenshot Add New WinForm file

The source templates for CSharp are located on my netbook at: “/usr/local/src/monodevelop-2.4/src/addins/CSharpBinding/templates”. The Makefile references the template files in this directory. I had to add two template files to the directory and to the Makefile and the file CSharpBinding.add.xml. Then I did a make within the directory /usr/local/src/monodevelop-2.4/src/addins/CSharpBinding and then a “sudo make install” and finally got my WinForm project and file template available in MonoDevelop.

Continue reading ‘Monodevelop: Howto add a WinForm project and file template’ »