I like to keep things organized, especially code. So when I finished the icon/tile design for my WP7 app I decided to place them in the Resources folder of my solution instead of the default (root project folder). I marked the images as Content and set them to always copy to output.
After a rebuild they appeared on the dropdown of the Application tab in the project properties window. See “TileBackground”.
I thought wow, this is going to be easy, I won’t even have to edit xml! I was wrong. What followed was hours of confusion and irritation.
Tile Background
When I tried to debug with the emulator to verify the icon and tile were updated I received the following error:
The application could not be launched for debugging. Ensure that the target device screen is unlocked and that the application is installed.
At first I thought my environment had been hosed so I restarted VS and the emulator, no change. Then I rebooted, no change. So I had to assume this error must be due to the icon/tile change I had made. I checked the WMAppManifest and only the image name was set. So I thought I must have to set the folder name, if the image is in a subfolder.
This fixed the tile background.
Application Icon
Next I tried to set the icon path in the same way but when I attempted to debug there was a new error:
Icon file Resources ApplicationIcon.png not found. Make sure that the file is present in the application.
Long story short, I wasn’t able to find a way to reference the icon image in a subfolder, I guess its not supported. In the end I decided its not worth the hassle and put them back in root. I suggest you save yourself the frustration and do the same.
If anyone has had a difference experience please leave a comment.
The problem you had was the image resource wasn’t getting built (outputted) to the bin directory. You need to make sure the images are being built out properly to the paths referenced in your /bin/debug (or release) directory. If you set the build action of your images as “Content” in the properties window while selecting the image, they should be built out to that location and you then you can reference it from within any folder.
They were output to the bin directory correctly when in the root but not when in a sub-directory for me. Maybe it was a beta issue, haven’t tried in a while.
I ran into this same problem the other day as well. I was using Content instead of Resource, but in the end I had to place the images at root too.
Hi!
I am just trying to change the IconPath from the WmAppMAnifest.xml but when I changed the name of the file it didn’t work, and the file is just next to the one was before.
ApplicationIcon.png
After that I tried to just leave the name as it was and change my new files name.. neither..
Any suggestions? I haven’t touched anything from the project! not even the name of the app!!!!
Make sure the Build Action is set to Content. I forget this all the time when changing the icon/background images.
Thanks..It worked for me.:)
Pingback: 超快递 beta版 » Windows Phone 7 资源汇总(超全)