How to integrate SP Dispose Check into Visual Studio Solutions


Table of Contents

The SharePoint Dispose Checker Tool when it is installed is placed by default at:

32-bit operating system:

C:\Program Files\Microsoft\SharePoint Dispose Check

64-bit operating system:

C:\Program Files (x86)\Microsoft\SharePoint Dispose Check

Visual Studio Tools menu

You can get this setup so that it is available in all your Visual Studio Projects by following these simple steps.

  • Select 'Tools | External Tools...' from Visual Studio
  • Click New and fill in details as per screen shot:

    NOTE: Command path points to C:\Program Files\Microsoft\SharePoint Dispose Check\SPDisposeCheck.exe.
  • The SP Dispose Check will appear in Tools menu now.

Selecting it will execute the checker and output results in Output window as shown below.

Visual Studio Project Build Targets

You can also edit your .proj file in XML editor and modify the AfterBuild target to include a call to this:

<Target Name="AfterBuild">
<Exec Command='"C:\Program Files\Microsoft\SharePoint Dispose Check\SPDisposeCheck.exe" "$(TargetPath)"' />
</Target>

Visual Studio Build Integration

There is a CodePlex project called spDisposeCheckEx that will integrate with your build process to actually prevent the dll from compiling. This is not the preferred recommendation as you may not want this to run EVERYTIME you do a build. Some developers will use Build command to validate their code is compiling and this will slow down process.

Not tested
This project has not been tested by me but thought it is worth adding here as an option.

Hopefully there won't be too much bad news that it reports!

Labels

dispose dispose Delete
integration integration Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.


  1. Jul 21

    GothorMontero says:

    thanks for the writing it helps me to do my writer job

    thanks for the writing it helps me to do my writer job


Creative Commons License
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License. Hosted generously by CustomWare