Thursday, 19 September 2013

Check code quality with SPDisposeCheck

Adding SPDisposeCheck to your VS solution is a good way to find potential performance and best practices issues early in the development cycle.

The code can be downloaded from http://code.msdn.microsoft.com/spdisposecheck

The installed executable (if you use the default settings like I did) is stored in
"C:\Program Files (x86)\Microsoft\SharePoint Dispose Check\SPDisposeCheck.exe"

The final step is to add the following script as a post build event:

cd $(ProjectDir)

“C:\Program Files (x86)\Microsoft\SharePoint Dispose Check\SPDisposeCheck” “$(TargetPath)” > “$(ProjectName)”.SPDisposeCheck.log

findstr /C:”Total Found:” “$(ProjectName)”.SPDisposeCheck.log

This will write the 'Total Found' with the number of SPDisposeCheck errors generated by the tool

No comments:

Post a comment