WP7 issue on W8 and VS2012

Dec 3, 2012 at 5:24 AM

Hi,

I'm quite new to the MS tech stack, but I'm very happy with the way the Physics Helper XAML works for Metro apps. Unfortunately I'm having no such success with the WP7 version - at least under my current environment (W8, VS2012). If anyone could suggest what I may be doing wrong I would really appreciate it.

When attempting to write a WP7 app (having included and recompiled the FarserPhysicsEngineWP7 and the Spritehand.PhysicsHelper.WP7) I cannot include a Physics canvas. Unlike the Metro versions where as soon as I typed "ph:" I got intellisense, the WP7 version returns the following error:

Error    1    The name "PhysicsCanvas" does not exist in the namespace "using:Spritehand.PhysicsHelper".    C:\Users\Peter Kenny\Documents\Visual Studio 2012\Projects\PhoneApp5\PhoneApp5\MainPage.xaml    34    17    PhoneApp5

The error is slightly different on the demo project:

Error    1    The command "C:\Users\Peter Kenny\Documents\Visual Studio 2012\Physics\Demos.WP7\Demo.Simple.WP7\..\..\CleanUsingXmlns\bin\Debug\CleanUsingXmlns removeusing C:\Users\Peter Kenny\Documents\Visual Studio 2012\Physics\Demos.WP7\Demo.Simple.WP7\..\..\Demos.Metro\Demo.Simple.Metro\ Demo.Simple,Spritehand" exited with code 9009.    Demo.Simple

As stated, I think this is a great assembly and I'm sure I'm doing something stupid, but I can't work out how to fix the problems.

Any and all help appreciated.

Coordinator
Dec 3, 2012 at 11:28 AM
Edited Dec 3, 2012 at 11:29 AM

Hello,

It looks like you are hitting issues with the utility "CleanUsingXmlns" that tweaks the XAML so that _both_ Windows8 and WP7 can be supported. The CleanUsingXmlns utility changes the xmlns entries in xaml files at build time to support either WP7 or Win8. I'm not sure what is going on in this case but maybe it is a problem with the path containing spaces or being too long?

You can read more about this issue here - http://www.andybeaulieu.com/Home/tabid/67/EntryID/222/Default.aspx

...but in summary -

xmlns changes
To reference an external library in XAML, we need to use the xmlns attribute. WP7 and Win8/Metro handle this differently right now (hopefully this is remedied in the future!)

WP7 and Silverlight look like this:
xmlns:xx="clr-namespace:xx"

While Win8/Metro looks like this:
xmlns:xx="using:xx"

 

 

Dec 4, 2012 at 2:15 AM

Hi Andy,

Thanks for the very quick reply. I've read through your blog and I understand what the CleanUsingXmlns utility is trying to achieve. Replacing the xmlns declaration with the following did the trick.

xmlns:ph="clr-namespace:Spritehand.FarseerHelper;assembly=Spritehand.FarseerHelper"

I now have happy objects bouncing around my phone. Naturally now that it's working i have 1000 more questions ... :-)

But for now, cheers - and thanks a bundle for the support.

Pete.