在WP7項目,圖片資源檔的屬性對話方塊Properties,在Build Action項有很多選項,但WP7中只支援:Content、Resource、none這三種。
設定為Content時會直接將圖片檔案打包到XAP檔案中,就是說用ZIP查看器可以直接看到你的圖片檔案;
設定為Resource後,圖片會編譯到XAP的Dll檔案內;
設定為none後,圖片既不會直接打包在xap檔案中,也不會嵌入xap中的dll內,編譯過程會完全忽略該檔案。
一般情況下,用Content更簡單,能獲得更好的效率。
MSDN的原文:
Set Build Action to Content for Media
Media processing on Windows Phone is optimized to use files and network streams, but not in-memory streams. This means that any media files included in the application, such as sound effects, should have their Build Action set to Content and not Resource. When a media file is compiled as content, it is stored as a loose file alongside the application file (.XAP) and is not stored inside it. When a media file is compiled as a resource, you typically access it by retrieving a stream to the file, which can decrease performance. Also, when a media file compiled as content is played back, it is played directly. When a media file is compiled as a resource, the content is copied to a file on Windows Phone before playback, which decreases performance. The following illustration shows how to set the Build Action of a file in Visual Studio.
有關Build Action的相關內容,參考這裡