Posted tagged ‘Windows 8 Phone’

Fixing POSTestNativeUtils Reference to work in Emulator and Device

February 4, 2014

Late 2013 Microsoft released Windows Embedded 8 Handheld OS that adds capabilities on top of Windows 8 Phone (GDR3).  One notable feature in particular is the Barcode Scanning api’s.  Included in the SDK is a dll called POSTestNativeUtils.dll that has a FakeScanner helper to assist in simulating barcode scans when running in the emulator.

I found that the emulator was running as x86, however, the device I am using is running as ARM.  This created a painful experience as you can only reference either x86 or ARM version of POSTestNativeUtils through Visual Studio User Interface.

Error

If referencing the ARM dll and trying to run on the emulator you will see an error like this.

“Deployment failed because an app with target platform ARM cannot be deployed to WE8H Emulator WVGA. If the target platform is win32/ x86, select an emulator. If the target platform is ARM, select Device. ”

Solution

To solve this update the csproj file to add the reference based on a condition.

<ItemGroup>
  <Reference Include="POSTestNativeUtils" Condition=" '$(Platform)' == 'ARM' ">
    <HintPath>..\..\Lib\Win8EmbeddedHandheldSDK\v8.0\Libraries\arm\POSTestNativeUtils.winmd</HintPath>
  </Reference>
  <Reference Include="POSTestNativeUtils" Condition=" '$(Platform)' == 'x86' ">
    <HintPath>..\..\Lib\Win8EmbeddedHandheldSDK\v8.0\Libraries\x86\POSTestNativeUtils.winmd</HintPath>
  </Reference>
</ItemGroup>

References

Hope this helps!