Windows Phone 7.8 SDK – One Tile code base to rule them all

Previously I wrote about how to use reflection to take advantage of Windows Phone 8 tiles on Windows Phone 7.  I recommended this for those who want to keep the same code for both version of Windows Phone instead of branching it and making one version for Windows Phone 7 and one for Windows Phone 8.  I still recommend this if you aren’t taking advantage of any Windows Phone 8 specific features.  This worked fine until today when Microsoft released the Windows Phone 7.8 SDK.  7.8 gives Windows Phone 7.x users the ability to get a variety of tile sizes, and for you, more code reuse.  Now you will really get a lot more mileage out of your code since this same code will work for Windows Phone 7.1/7.8/8 if you follow this method.

If you followed the example in my earlier post (which you should) all holds true except one line, the line where you set the targeted version:

You will need to set the above new Version class to 7, 10, 8858 as shown above.  This is the major, minor, and build # of Windows Phone 7.8.

You might be tempted to change this value in your WMAppManifest.xml but don’t!

We already set this (in my earlier post) and if you are reading Microsoft’s documentation on Windows Phone 7.8 SDK, it says to set it to the value we already have.  Don’t be confused by the AppPlatformVersion of 7.1 .  This stays put.  If you do change this value you will get the following error when compiling:

Error The ‘AppPlatformVersion’ attribute is invalid – The value ‘8.0’ is invalid according to its datatype ‘http://schemas.microsoft.com/windowsphone/2009/deployment:ST_AppPlatformVersion’ – The Enumeration constraint failed.

Again, if you see the above error it is because you changed the AppPlatformVersion from 7.1 to something else.  Read Microsoft’s documentation carefully, it says to change AppPlatformVersion in the AppExtra attribute, not Deployment.

 

If you made the changes above along with the ones in my earlier post you will see that you can now use the same code base for all 3 versions of Windows Phone!  You can create live tiles, one of each size with the content on the flip side you choose.

 You can see this in action in my Windows Phone app, Space Weather.  I am submitting a new version tomorrow with the said changes above.

11 thoughts on “Windows Phone 7.8 SDK – One Tile code base to rule them all

  1. i tried now but again the same invalid child element ‘AppExtra’. List of possible elements expected: ‘App’.

    if i start to write the AppExtra element it doesnt show up, it shows only App 🙁

      1. i dont know if disqus supports pasting code but i will try to paste it here…

                      ApplicationIcon.png          <!–                              <Capability Name="ID_CAP_MEDIALIB" /      –>            <!–            –>      <!–                  –>                                              Background.png          0                             

      2. here is an screenshot, maybe it is better visible then pasting code here… http://sdrv.ms/10vXcbj

        and above you see that the 7.8 SDK is installed, there is the emulator, and i can start it, i see the new interface and everysthing works, only the biggest part of the SDK not and thats the live tile sizes 🙂

          1. i tried now something other, i opened the wmappmanifest.xml in notepad++ and added the appextra tag and reopened it again i visual studio and opened there the wmapmanifest and the appextra is not there. if i close again the solution and open it via notepad++ i see it :S that should not be this way, or? But after building the solution again it makes a new wmappmanifest with only the data from visual studio. i dont know why it dont accept the appextra tag as a child from development

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.