This project provides a custom MSBuild Task for invoking the SPDiposeCheck code analysis tool during your build.
For information on SPDisposeCheck, what it does, and how to use it, visit http://code.msdn.microsoft.com/SPDisposeCheck
To use this task, you'll need to copy the .dll and the .targets file into your buid dependencies.
In your MSBuild file, add an <Imports> directive for SPDisposeCheck.targets. For example:
Now you can execute SPDisposeCheck by adding the <SPDisposeCheck> task to one of your build targets. For example:
<Target Name="CodeAnalysis" DependsOnTargets="Build">
<SPDisposeCheck AssembliesToCheck="$(MSBuildProjectDirectory)\bin\Debug\My.SharePoint.Assembly.dll" />
The Task assumes that SPDisposeCheck was installed on the hose machine in the default directory. To override this behaviour, specify the path to the executable in the optional SPDisposeCheckExe parameter on the task. For example:
<SPDisposeCheck AssembliesToCheck="$(MSBuildProjectDirectory)\bin\Debug\My.SharePoint.Assembly.dll" SPDisposeCheckExe="$(MSBuildProjectDirectory)\lib\SPDisposeCheck.exe" />
If you have any problems, please feel free to contact me on bitbucket (bitbucket.org/jaysee00) or twitter (twitter.com/jaysee00).
Happy SharePoint Coding!