Fixing POSTestNativeUtils Reference to work in Emulator and Device
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.
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. ”
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>
Hope this helps!
Tags: Windows 8 PhoneYou can comment below, or link to this permanent URL from your own site.