mdibb.net

Developing ASP.NET with SharpDevelop

For some time I didn't have a copy of Visual Studio, which made developing ASP.NET code something of a pain - essentially you ended up limiting your self to using .aspx files with inline code and using Trace.Write() or worst still simply echoing out debug messages to the page you were developing - there is only so far you can go like this!



This is where SharpDevelop comes in. SharpDevelop is a free, open source C#/VB.net IDE for use with .NET 1.1 and offers a lot of the bells and whistles that Visual Studio does (like intellisense and syntax highlighting); its primarily intended for use with devloping 'traditional' applications (i.e. command line applications, standard windows applications), but we can configure it so that it'll happily compile the DLL files we need for ASP.NET code behind - here is how:
  1. Start up SharpDevelop and create a new combine
  2. In the "New Project" dialog, select either C# or VBNET, and then select the "Empty Project" icon.
  3. Now give your project a name, and chose the path where you'd like to store all of the files. If you are putting your files directly into your ASP.NET application's directory on the server (probably not the best way to do things, but there you go) make sure you untick the "Autocreate project subdir" option.
  4. Ok, now the important step - IIS will expect to find an ASP.NET's DLL in the <apppath>bin folder. To configure SharpDevelop to output directly to this folder, right click on the project in the projects tab, and goto the "Project Options" menu item.
  5. In the "Project Options" dialog, goto the "Configurations" branch and chose which configuration you want to alter (I'm going to select Debug here), then click on the "Output" item.
  6. Change the "Compile Target" to "Library"
  7. Now, shorten the "Output Path" so that instead of going to <apppath>binDebug (Its debug here - it will depend on what Configuration you chose) it points to <apppath>bin instead.
  8. Hit "Ok" to close the "Project Options" screen.
You're now set and ready to go - just code your classes as usual, and when you're ready to test it, simply go to the Build menu and select "Rebuild Combine" (or just press Alt-F8). This will compile the DLL and put it in your application's bin dir, ready for use. All you need to do now is go to your browser and test it! Check my other entires for how you can debug your ASP.NET applications without visual studio.

Back 23.02.2006.