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.

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!

Explore posts in the same categories: Windows Embedded 8 Handheld

Tags:

You can comment below, or link to this permanent URL from your own site.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: