SPDisposeCheck in Visual Studio

One of the comments I have gotten from the latest USP Journal issue is that running the SPDisposeCheck is awkward because you have to do it via command line.

That’s not necessarily true, there’s an easier way.

Visual Studio supports external tools, allowing you to run command line tools and get the output in the Visual Studio output window. Since SPDisposeCheck is a command line tool, that’s a perfect match.

To set up SPDisposeCheck as an external tool in Visual Studio, go to the Tools->External Tools menu option. Click Add and fill in the form by browsing to the SPDisposeCheck.exe file (usually in C:\Program Files\Microsoft\SharePoint Dispose Check\SPDisposeCheck.exe) and select TargetPath in the Arguments field drop-down, as shown below.

Figure 1

Finally, ensure that the Use Output window checkbox is checked, and hit OK.

Check your Tools menu, and you should have a new option for SPDisposeCheck. Selecting this option will run SPDisposeCheck and output the results from checking your DLL or EXE in the Output window of Visual Studio.

Figure 3

If you want a faster way of accessing SPDisposeCheck, add an & in front of one of the letters in the Title field. That letter now becomes the shortcut key for accessing SPDisposeCheck from the Tools menu. For example, if you set the title to SPDisposeC&heck;, you can run the command using ALT+T (for Tools menu) and then hit H. Sadly, H is the only letter in SPDisposeCheck not already occupied by other menu commands, but you are, of course, free to set the title to anything you like, such as Xyzzy and use X, Y, or Z as the quick-key 🙂

Figure 2


Found this article valuable? Want to show your appreciation? Here are some options:

a) Click on the banners anywhere on the site to visit my blog's sponsors. They are all hand-picked and are selected based on providing great products and services to the SharePoint community.

b) Donate Bitcoins! I love Bitcoins, and you can donate if you'd like by clicking the button below.

c) Spread the word! Below, you should find links to sharing this article on your favorite social media sites. I'm an attention junkie, so sharing is caring in my book!

Pin It

SharePoint Visual Studio Workflows for Non-Developers?

UPDATE: The issue mentioned in this post is available at http://www.sharepointvisualstudioworkflows.com/

So, it’s time to do the second part of the USPJ Business Process Management series. This time, I’m going out on a limb, and I’m going to write a Visual Studio Workflow issue for non-developers.

You may wonder why I would write a non-developer issue based on one of the most hard-core developer tools there is. The idea here is to try to gently bridge the gap between advanced end-users and the power of Visual Studio workflow. I’m not going to try to make programmers out of you, but rather to introduce you, as gently as possible, to the world of real workflow power.

How, you say? Well, I’m staying away from the programming stuff as much as possible. I might end up with some short code snippets for illustration, but I’m going to do this using no-code approaches. That way, you will get an easy introduction to working with Visual Studio without having to learn C#, VB.NET, or any of that stuff.

I’ve received a lot of feedback from the readers of Issue 4 on SharePoint Designer Workflows that the content in the other issues is ‘over their heads’. I certainly understand that, the target for the other issues have been somewhat experienced programmers, and not everyone wants to take the leap into learning programming just to utilize more SharePoint features.

However, as I said, I’m going out on a limb here, because this may be a very wrong approach. Targeting non-developers may alienate experienced developers, and introducing developer tools to end users may still be a too big leap.

So, I’m asking you:

If you are an experienced developer (meaning you know the difference between a class and an object), would you be interested in a USPJ issue on no-code workflow development in Visual Studio?


If you are an end user, would you be interested in learning to use Visual Studio to create even more powerful workflows than you can with SharePoint Designer?

Feel free to send your comments to furuknapgmail.com if you do not want to comment here.


UPDATE: The issue mentioned in this post is available at http://www.sharepointvisualstudioworkflows.com/

Pin It

How to Create Killer SharePoint Applications with Four Simple Techniques

You’re a developer, or an aspiring developer, on SharePoint, and you’re looking to create the most compelling solutions for your customers or for the public.

Where do you start? I’ll explain my take on the situation.

A CustomAction a Day…

CustomActions is your ticket to user interface nirvana. Mastering either the static CAML-based CustomAction elements, or going to the slightly more advanced dynamic CustomAction elements, allows you to manipulate menus, lists, toolbars, and pages as easily as a few lines of XML code.

Featuring the Handler

Event handling in SharePoint allows you to interact with certain actions happening in SharePoint. You write a piece of .NET code, attach that to the event you want to handle, and poof, you have access to manipulate the event in pretty much any way you can imagine.

Learn to Delegate Control

If event handlers are cool for specific events, imagine how cool it would be to capture and manipulate any page in a SharePoint solution. You need to add a piece of JavaScript to all pages in a solution? Delegate it to a control. Do you want to capture user behavior patterns? A DelegateControl runs on any page, cross-page, cross-site, and cross-application if you like.

Yet Another Application Page

I know, I know, application pages are global and you shouldn’t create new pages for every little thing. However, hear me out. Application pages are often necessary, and learning how to create one has an added and beneficial side effect: The patterns for developing application pages has a lot of similarities with developing web parts. Mastering one will make it a lot easier to master the other.

So, How Do I Create Killer Applications with These Techniques?

Well, consider a few solutions that I have recently made.

  • SPCurrentUsers (on CodePlex)
    SPCurrentUsers tracks users’ behavior in a site using a DelegateControl that runs on every page a user visits. The interface for the administrator is through a dynamic CustomAction that displays the current number of logged-on users. A custom application page provides detailed views of the currently logged on users and their latest page views. Everything is set up and activated using a setup feature handler.
  • SPThemes (on CodePlex)
    SPThemes adds custom themes support to SharePoint by outputting a CSS link though a DelegateControl. Access to setting the configuration interfaces is done through both static and dynamic CustomActions. Two application pages provide site owners and users access to configure the solution. You set up and activate the solution using a setup feature handler.
  • SPSampleData (on CodePlex)
    SPSampleData extracts data from lists and generates a ListInstance element for use in a feature. The list gets a dynamic CustomAction to access an application page for the actual extraction.

Do you see the pattern here? It’s not that I’m a few-trick dog, but rather that these techniques are versatile and highly adaptable, enabling you to create compelling SharePoint solutions with just a few tricks in your toolbox.


Pin It