27 August 2014

Simple workaround for “Design view is unavailable for x64 and ARM target platforms”

When you are developing for Windows Phone or Windows and you are faced with using a native component (for instance the Bing Maps control on Windows, or the SensorCore api on Windows Phone) you will loose your designers when you are testing, both in Visual Studio and in Blend, as they will only work for “AnyCPU”  or “x86” configurations.This is highly annoying, but there is a kind-of fix.

The trick is to create an extra configuration. I usually make a copy of “Debug”, which I call “DebugArm” I do this by right clicking on the solution, selecting “properties”, and then hit “Configuration Manager”

image

Then I make a copy of Debug, by selecting “New” in the “Configuration” drop down, and I make a copy of Debug, called DebugArm.

image

In that solution I set everything to ARM:

image

So far so good, and nothing new. Now select the Debug project configuration again in Visual Studio, hit “Save all” and compile. Then open the solution in Blend. You will notice of course the designers now work, but now you cannot deploy. Changing that configuration every time again is slow and cumbersome, and it won’t be picked up by Blend. So you have to restart that time and time again. This now, my friends, we will use to our advantage.

Go back to Visual Studio, select “DebugArm”. You can now deploy and test again, but your designers will of course go dead again. But like I said Blend does not pick up that configuration change. Apparently that is only read at startup. So that will keep the Debug configuration and the designer still will work! So now you can use Blend to do design changes, and Visual Studio to actually run and deploy, using two different configuration settings, without having to change al the time!

This switchemarole you have to do every time you start Visual Studio and Blend. Granted, it’s not ideal, but a lot less of a hassle than constantly having to change configurations, which is is slow, while now you only have to select a different Icon in the Task Bar. And this is how it should be done most of the time IMHO – Blend is for the UI, Visual Studio for code.

No code this time, as this is a tools-trick only post.

No comments: