SharpDevelop, A Getting Started Guide

SharpDevelop is truly an old friend of mine, with regard to having a constant programming companion on the MS Windows platform. Not only is it an always-free proposition, but it is vastly simpler to set up an application structure, include libraries, and become productive quickly, than an equivalent object-code program would be. Object-code compilers will always be with us, but I think at this point the numbers of .NET programmers have probably surpassed those of most other programming disciplines (and this is another advantage, because more users means more code support, better documentation, more sample code, more and better libraries). You can also program C# on other operating systems by using the Mono framework, although I personally have not tried this. To top off the list of benefits, the .NET library is almost guaranteed to be installed on any computer where I might find myself employed.

With only a few exceptions, I do almost all my own routine programming work using C#/.NET and using SharpDevelop. One drawback that I can identify at present is that SharpDevelop cannot debug 64bit code (although it can build 64bit programs which can be run from the Windows shell), but I’m sure this will change with time. Another drawback is that the XAML editor is not as easy to use as I would like, and at times it seems downright unfriendly to the idea of free-form design. After spending time with the XAML designer you can get used to its idiosyncrasies, and it turns out these are more attributable to dementia among Microsoft engineers than the SharpDevelop team.

What Is SharpDevelop?

Just to provide a little background and context, SharpDevelop is a free, open source, IDE (Integrated Development Environment), built using the .NET framework, by a small development team in Germany. SharpDevelop is designed to perform programming project management for .NET targets and to act as a front-end for several language compilers. In essence it’s a light-weight version of MS Visual Studio, and while Visual Studio costs thousands of dollars, SharpDevelop is and probably always will be free (though they might have some kind of business model in mind to generate revenue). I won’t deny that SharpDevelop has fewer features than Visual Studio, but you have to consider how much smaller their development group is than the Microsoft hoard. The plus side of that however is that SharpDevelop runs at a fraction of the RAM and CPU cycles than Visual Studio does.

SharpDevelop Image1
 

The Visual Interface Designers

Version 4.4 is the current distribution for SharpDevelop, and version 5.0 is released in beta 2 as of 2/19/2014. I have used SharpDevelop since at least version 3.2 , and I have always had success with WinForms (the System.Windows.Forms namespace) for doing quick visual design of a user interface before entering code. The new visual editing system, based around XAML (eXtensible Application Markup Language), could stand some improvement in my opinion. I know the positioning and layout control could be made more intuitive, as it currently represents a throwback to a more primitive time. Sifting through the available container panels for one which could anchor child controls was like being lost in a sea of barely usable UI decisions. After finding one that met my needs (the DockPanel) it turned out that the mechanisms for positioning and anchoring child controls are about as non-obvious as it’s possible to get. Another strange and unfriendly design decision concerning XAML is that a number of primary controls (including the top-level window control) may only contain one child control.

If you’re able to accept some of the XAML detractions, the .NET library and SharpDevelop still offer ease of use and functionality superior to many other development environments. SharpDevelop is able to accomodate several languages, such as C++, C#, F#, and VB.NET, as well as tools for profiling and unit testing. It is also able to output several important build targets, such as Silverlight, ASP.NET, WIX, the standard desktop application, and something called WCF (sorry I haven’t looked too closely at this one). In addition, SharpDevelop version 4.x accomodates the languages Iron Python, Iron Ruby, and a language called Boo, although I’m not sure if these will continue being supported with version 5.x . If you’re a Microsoft junkie, or if you’re forced to work in a Microsoft Windows environment, then SharpDevelop will meet many of your needs.

SharpDevelop Image2
 

SharpDevelop Installation Details

There are a great many useful and interesting applications which were built in the early days of .NET which are still floating around on coding sites , and SharpDevelop v3.2 is able to open these older project formats and convert them to the newer format. For this reason I always keep one copy of SharpDevelop v3.2 within easy reach for performing these conversions. You can download all the SharpDevelop versions here. This download page also describes related software which can be used in conjunction with SharpDevelop, such as the Windows Platform SDK and the .NET Framework, so it’s a useful resource. Of course the .NET library itself has changed significantly from its early incarnation, so getting those older applications to compile is a different issue.

I’ve found that it’s possible to have multiple versions of SharpDevelop installed, since there don’t appear to be any library dependency problems, and I just keep a shortcut to each one handy. The SharpDevelop team also developed their own .NET code disassembler called ILSpy, and if it doesn’t install with SharpDevelop, then you can always download ILSpy from here. Download the ILSpy binaries unless you’re planning on joining the development team. You can access ILSpy from within SharpDevelop by right-clicking on a .NET library element, and then selecting Open ILSpy. If it can’t find ILSpy, just provide it the full path to ILSpy.exe.

SharpDevelop Image3

SharpDevelop Image4
 

Starting a New Project

If you plan to use WinForms then open a new project as C# | Windows Applications | Windows Application. Otherwise if you wish to use XAML and the Windows Presentation Foundation, then open a new project as C# | WPF | WPF Application. The new project wizard will take care of adding necessary assembly references to support each particular build. If you’re new I would recommend playing around with WinForms for a while, since it’s more intuitively easy to use, and then later graduate to WPF. The new project wizard requires you to supply a directory where the files will be placed.

SharpDevelop Image5

SharpDevelop Image6

SharpDevelop Image7
 

Getting Around the IDE

The project build button is in the toolbar, and running the project within the debugger is the solid green arrow right next to it.

SharpDevelop Image8
 

The build output appears at the bottom of the IDE in a window titled Output.

SharpDevelop Image9
 

You can add program startup code inside the MainForm constructor

SharpDevelop Image10
 

Clicking the Design button at the bottom of the editor allows you to drag and drop visual elements from the tools panel onto your WinForm.

SharpDevelop Image11
 

You can access properties of the visual control, and create event callback methods on them, from the properties panel.

SharpDevelop Image12

SharpDevelop Image13
 

Double-clicking directly on the visual control in most cases will create a mouse button-click event within which you may add your code.

SharpDevelop Image14
 

Of course there are several dozen built-in controls to use, so the button example is just the tip of the iceberg. You can get contextual help on any C# language or .NET library element by simply placing your cursor within its text and hitting the F1 key. If this doesn’t work for some reason you may have to install the Microsoft help system manually.

Project settings are accessed by right-clicking on the project name within the project explorer panel, and selecting Properties.

SharpDevelop Image15

SharpDevelop Image16
 

Common Build Errors

When performing a build, if you get error messages concerning missing libraries, you can add these references from the project explorer panel. Simply right-click on the references project item, and select Add Reference. From the add references dialog, select the GAC tab and find the assembly you need to add (this may involve using the Microsoft Help to determine which assembly is required for a given .NET library element). Double-click the assembly you wish to add, then select Ok. After adding the assembly, then add a using statement at the top of your source file so the assembly contents can be accessed.

SharpDevelop Image17

SharpDevelop Image18

SharpDevelop Image19
 

Summary

That’s all there is to creating a C#/.NET application using SharpDevelop. These programs are dead easy to build, which is why the world has migrated to these more advanced languages and build environments. I can tell you from experience that the C# Using feature, assembly references, and encapsulation of everything within classes make it enormously easier to work with than C++ , which includes headers and libraries from disparate sources and often results in endless lists of compile and link errors.

Reference Links

Download links for all SharpDevelop versions
Changes and Release Announcements
SharpDevelop 5 Notes
SharpDevelop 5 Notes – Developer Daniel Grunwald
SharpDevelop 4 Notes

 


Comments

  1. Hello Web Admin, I noticed that your On-Page SEO is is missing a few factors, for one you do not use all three H tags in your post, also I notice that you are not using bold or italics properly in your SEO optimization. On-Page SEO means more now than ever since the new Google update: Panda. No longer are backlinks and simply pinging or sending out a RSS feed the key to getting Google PageRank or Alexa Rankings, You now NEED On-Page SEO. So what is good On-Page SEO?First your keyword must appear in the title.Then it must appear in the URL.You have to optimize your keyword and make sure that it has a nice keyword density of 3-5% in your article with relevant LSI (Latent Semantic Indexing). Then you should spread all H1,H2,H3 tags in your article.Your Keyword should appear in your first paragraph and in the last sentence of the page. You should have relevant usage of Bold and italics of your keyword.There should be one internal link to a page on your blog and you should have one image with an alt tag that has your keyword….wait there’s even more Now what if i told you there was a simple WordPress plugin that does all the On-Page SEO, and automatically for you? That’s right AUTOMATICALLY, just watch this 4minute video for more information at. Seo Plugin

    • Thank you very much. I thought my life was complicated enough, but you have just shown me how it can become intensely moreso. Kind regards.

Leave a Reply

Your email address will not be published / Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">