Adding Windows Phone Capability Detection to your Build Process

There is a new Capability Detection tool in the Windows Phone Developer Tools October update that you can run to determine the capabilities of a DLL or Xap files.  Here is a post build step that I added to a WP7 project to list the capabilities that are explicitly needed for an application:

 set CAPDETECT=%ProgramFiles(x86)%\Microsoft SDKs\Windows Phone\v7.0\Tools\CapDetect\
pushd %CAPDETECT%
@echo Detecting Capabilities of "$(ProjectDir)$(ConfigurationName)"
CapabilityDetection.exe Rules.xml "$(ProjectDir)Bin\$(ConfigurationName)"
popd

If you don’t accurately list your application capabilities in your application manifest, your application will get rejected when submitted.