Posts

Showing posts with the label Visual Studio 2010

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

Token Replacement in Visual Studio

I was working on a simple WCF service, including a generic handler (.ashx). My code looked good until I tried to access the url - it started complaining that it did not know what ' $SharePoint.Project.AssemblyFullName$ ' was. A little digging ( here  and here  ) revealed at VS will not replace its tokens in all file types - you may need to specify them in the project file. Generic handlers are one of those types. So, first I unloaded the project and added the following to the property group: <PropertyGroup>  <TokenReplacementFileExtensions> ashx </TokenReplacementFileExtensions> </PropertyGroup> I then reloaded the project and redeployed. Too easy.