When you build your WP7 app, you may get the following cryptic error after a successful compilation: MSBUILD : error : Xap packaging failed. Object reference not set to an instance of an object.
This error means one of the core files referenced in the WMAppManifest.xml is missing. This can be either due to the file being renamed or deleted, or just of the wrong build type. Open up your WMAppManifest.xml file in the Properties folder and take a note of the IconPath and BackgroundImageURI values. Make sure the paths are correct and the files are present. Also make sure that if IsResource is set to false, that the graphic has a Build Action of ‘Content’.