by brad
17. September 2010 06:00
Today’s a short and sweet tip that sprang from a moment of curiosity I had. It’s quite possible that most everyone but me already know this.
I’ve never really paid much attention to the “Copy to Output Directory” property of files (specifically, images) in my Windows Phone 7 project. In the back of my mind, I always wondered what the correct choice was, but things always just worked so I didn’t question it.
If you’re not familiar with this property, it’s available for every file in your project. The valid choices are “Do not copy”, “Copy always”, and “Copy if newer”.
For a Windows Phone 7 project, the “Output Directory” is “Bin\Debug” by default. This is the same folder where the XAP will be placed. And regardless of what you choose, all of your images will be included in the XAP file. So for a Windows Phone 7 project, this setting has no impact to your application since the XAP is the deployment package.
As a test, build your file with “Do not copy” and then “Copy always”. In both cases, the file will be included inside the XAP. The only difference will be if the file ends up copied to your hard drive in the “Bin\Debug” folder.
More Tips