SharePoint Sharpener

Obsessively Sharpening SharePoint

Archive for July 2008

Using Console Apps for Proofing SharePoint Code

leave a comment »

Developing SharePoint solutions involves so much more than just coding, i.e. installing features, setting trust levels, associating with lists etc. This means that many things can go wrong on the road from idea to finished product.

Even if you just want to test a simple idea for a web part you still have to go through the process of installing the feature, inserting the web part on a page and so on. Far too time-consuming and annoying if all you want to do is throw a few lines of code at the SharePoint object model!


Quick proofing

More often than not, you don’t need the extended interface that a web part provides, in fact, a command prompt will probably be more than adequate.

That’s why you should use a console application for testing concepts; it’s really easy. Just create a new project and select Visual C# > Windows > Console Application:


Then add a reference to Microsoft.SharePoint.dll, and off you go:


Hit F6 to build and then run the the exe-file in a command prompt:


It really doesn’t get any easier than that.

Now just leave the sandbox and its command prompt open while working on other projects. Then you can return to the project at any time to test out ideas with a minimum of fuss.

Written by Thomas Sondergaard

July 3, 2008 at 9:37 pm