SharePoint 2010 Console App, Project Template

Posted on 2/14/2011 @ 6:33 AM in #SharePoint by | Feedback | 1903 views

I wish I had done this earlier, I have wasted so much time over the past 2 years doing the following.

  • Create a console app
  • Add reference to Microsoft.SharePoint.dll
  • Hit F5, curse because I forgot to set the framework to .NET 3.5
  • Right click properties, change framework to .NET 3.5
  • Hit F5, curse again because I get a FileNotFoundException, because I forgot to make it a x64 app.
  • Finally on my way, 2 minutes later – which has added to atleast 2 hours over the last year.


Well, no more! Presenting, the SharePoint console app project template.
What? You want it too? Okay, you can download it at the end of this post.

Installation Instructions: (Which should be unecessary since you’re a developer, and therefore smarter than most people by definition),

  • Download the .vsix, link below; double click, install, restart visual studio.


Usage instructions:

  • Start Visual Studio 2010
  • Go to C#\SharePoint\2010, and look for “SharePoint Console Application”,
  • Yup that’s it, create your console app, time saved.

Hope u like it.

Sound off but keep it civil:

Older comments..

On 2/12/2011 10:53:56 AM Tobias Zimmergren said ..
Hey Sahil.

What differs this one from the one in the CKS:Dev kit that's been around for a while?

On 2/12/2011 12:27:39 PM pedro said ..
Hi man! There is also the CKS plugin, that has a bunch of project templates, including the one you have just developed. I love your postings! Keep pushing Sahil.

On 2/12/2011 3:51:49 PM Jason Rastovski said ..
Linqpad works very well too -> You can set your default references and usings for the program. You'll find yourself building everything in Linqpad & then copy/paste into you actual code! (They have a free version which is great, but the paid version adds intellisense, which is pretty cool, but not necessary)

On 2/12/2011 3:53:16 PM Sahil Malik said ..
Ah that, totally forgotten about it.

On 2/13/2011 3:54:54 AM Sahil Malik said ..
Wait a minute, I thought LINQPad was only for LINQ related stuff. Can you do normal C# coding in LINQPad?

On 2/13/2011 7:26:26 AM Fred M said ..
Both of the links in this article are broken (404 errors) as of Sunday morning, 2011-02-13 around 7:00 AM. Please investigate and post when they are back in working order.

On 2/13/2011 3:15:28 PM Jason Rastovski said ..
RE: Linqpad -> At first, that's exactly what I thought as well...but you can do simple c# statements, or c# expressions, or a c# program.

I've set mine to default to c# program, and it functions exactly the way a console app would. Use the extension method .Dump() to 'dump' the contents of any object to the output window. It even converts Console.Writeline to the output window automatically. You can even define classes within the "c# program" area, and use them in your code. I used it just the other day to build an extension method class for an extension method called IsNumber() that I could use on strings.

(Just press F4 to add assembly references, and using statements)

I will say the only thing missing is the ability to set a breakpoint for debugging...however, with the .Dump() extension method, you can view the contents of any object


On 2/14/2011 6:35:05 AM Sahil Malik said ..
Okay the link should be fixed. Sorry first timer live drive neophyte :)