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

Comments

Popular posts from this blog

SharePoint 2013: Error updating managed account credentials

Error deploying Nintex workflow: An item with the same key has already been added