0
votes

I am trying to support both WP7 & WP8 in a same solution to use more recent libraries on recent devices. However, it doesnt seem to work...

Here is what i did :

  • Copied the project folder, renamed it and the project name inside of it to projectName8
  • Added a new project (the copy) into the solution
  • Upgraded the new project to WP8
  • Added the WP8 tag in the build settings of the windows 8 one
  • Deleted the MainView.xaml file from new one and linked the other projects one
  • Added a control loop like #if WP8 XXXXX #else YYYYYY #endif

However, when I debug the app on a windows 8 phone, the YYYYY instruction is called.... I really don't know how it comes and this is really boring... I noticed something wierd : In my code, only the YYYYY istruction is grayed. The other one is in normal color. Mabe is it a syntax error but I couldn't tell you.

#if WP8
            currentScore.Text="heho"; //Normal color
#else
            currentScore.Text="WP7"; //Gray color <=This line is called only
#endif
1
Are you sure you added the WP8 tag to every build configurations (debug, release, etc.)? - Olivier Payen
Yes I did ! I am wondering if the "debug" button isn't linked to the wp7 project rather than the whole solution... How can I check that ? - Vincent Monteil
Make sure you set the WP8 project as Startup project (right click on the project) - Olivier Payen
I will check that. Ty vm. Regarding the WP8 tag, will it be up on the release version or do I need to do something ? - Vincent Monteil

1 Answers

1
votes

As an alternative, you can check the OS version programmatically:

bool WP8 = Environment.OSVersion.Version.CompareTo(new Version(8, 0)) >= 0;

Of course, your code will always need to be compilant for WP7.