Subscribe to the RSS feed then follow me on twitter at @mrlacey

Tuesday, November 27, 2012

An undocumented way of creating a xap file you can't deploy to a #wp8 device

"Deployment failed" it's not a message you want to see when deploying your app to a device. Especially if you've previously deployed to the emulator without issue.

Even more worrying is this message:
"Deployment optimization failed due to an invalid assembly. Rebuild your source projects and try again."
Especially worrying after rebuilding several times.

A little googling for that message turns up the fact that this is also the error message displayed when trying to use the, now removed, WP8 version of the ReactiveExtensions but not a lot else. (As referenced at http://social.msdn.microsoft.com/Forums/en-US/rx/thread/ec22cacb-a996-4244-83ca-fe3b1d5ac5ff  and reported http://blogs.msdn.com/b/rxteam/archive/2012/11/14/update-on-windows-phone-8-support-for-rx-v2-0.aspx.)



It turns out that this was a result of an issue caused by a workaround after moving to TFS in the cloud.

Before moving to the cloud we had a powershell script which would rename the XAP file to include the version number of the main assembly. (This is invaluable during testing when you want to know you're installing the right version.)
Unfortunately this didn't work on the server.
Plan B was to use a simple command line app to rename the XAP instead.(It seems you can run [console] apps on the build server - but presumably with very little functionality actually available.)
To ensure that the exe was in the appropriate output directory I added it the project, set it's build action to None and set it to always copy to the output directory. This was the problem. The WP8 (this problem didn't happen in the WP7 version) compiler was seeing that there was an EXE in the project and doing something different with the final XAP.


Fortunately, this was resolved by adding the EXE to the solution directory and then referring to it from there without adding it to the project. The after build event still knows where everything is and all is good.


TL;DR/Lesson: Don't include desktop EXEs in your WP8 project, even if they're not included in the XAP.
And be sure to always test on actual devices, not just the emulator. It is possible for apps to run in the emulator and not even load on an actual device.


If you've built Windows Phone or Windows Store apps you can cross-promote them with AdDuplex to get more users.

3 comments:

  1. "And be sure to always test on actual devices, not just the emulator. It is possible for apps to run in the emulator and not even load on an actual device."

    Good advice, yet this seems to break the whole "emulator" thing, since it seems that it doesn't properly emulate a physical device!

    ReplyDelete
  2. The best replicas can butt even those who are abreast about the brand.If you wish to replica watches uk be abiding you are affairs the absolute thing,accomplish your acquirement from a acclaimed banker who is listed on the Rolex website.If you're blockage out a acclimated archetypal or eying a friend's,there are signs you can attending for to advice you atom a fake.Fake Citizen watches accept cartier replica abounding the watch bazaar alone in the accomplished 5 years,although the budgetary accumulation of affairs a affected Citizen over the 18-carat alarm is minimal.Spotting affected Citizens is difficult because the affected versions generally affection the aforementioned apparatus as the 18-carat article,but they are gucci replica fabricated with cheaper materials.Mybagshop.com offers accomplished superior replica accoutrements and handbags for all occasions.The abundance houses some of the a lot of accepted replica articles including replica chanel bags,replica gucci bags,replica handbags,replica drillmaster handbags,louis vuitton replica handbags hublot replica replica louis vuitton handbags,drillmaster replica handbags,replica chanel handbags,artist accoutrements and a lot more.You are aswell acceptable to acquisition all the qualities of accomplished handbags in the replica bags,which are offered by this store.The abundance aswell prides on affairs replica accoutrements that are louis vuitton replica fabricated from the aforementioned actual as the accurate handbags,which is cowhide covering and assumption hardware.

    ReplyDelete