Updated 6th March 2018:

Zebra has now released EMDK for Xamarin as a Nuget package (currently a beta release of version 2.7): EMDK For Xamarin Nuget Install [BETA] - Zebra Technologies TechDocs .  You should only follow the steps in this post if you require EMDK for Xamarin support at a specific version in Visual Studio 2017

Original post:

 

Microsoft recently announced that they are closing down the Xamarin component store and encouraging developers to move to NuGet to include 3rd party packages in their applications, as part of that effort the Xamarin Component store is only visible to projects which currently use Xamarin components in their applications.

 

This is a problem for EMDK for Xamarin developers on Zebra devices creating new applications since the EMDK for Xamarin is currently only available as a component.

 

The team are working to release EMDK for Xamarin as a NuGet package but in the meantime, here are your options for getting EMDK for Xamarin working with Visual Studio 2017

 

Creating a greenfield application

Starting from scratch and following the EMDK for Xamarin setup guide you will encounter difficulties following the second step which details how to ‘Install the Xamarin Component’, you are instructed to “Right click on the Project’s Component folder in the Solution Explorer” which is not possible in VS2017 since Microsoft have removed the ‘Component’ folder.

 

Instead:

  • Create your Xamarin application as you would for any new Xamarin app
  • Install the EMDK Visual Studio extension, this is step 1 in the EMDK for Xamarin setup guide and has not changed.  A word of warning, the documentation does not seem to have been updated to take account of the introduction of Visual Studio for Mac.
  • Here is the bit that is different from earlier versions of Visual Studio: To add the Xamarin component to your project you need to manually edit the .csproj for your project:
    • Copy the contents of the Components zip file attached to this post to the root of your Visual Studio Solution, so it is at the same level as your .sln file and the folder above your .csproj file.
    • Edit your .csproj file to add the following reference (shown in context):
<Reference Include="Mono.Android" /> 
<Reference Include="Symbol.XamarinEMDK, Version=2.6.0.70, Culture=neutral, processorArchitecture=MSIL">    
<SpecificVersion>False</SpecificVersion>    
<HintPath>..\Components\emdk-component-2.6.0.70\lib\android\Symbol.XamarinEMDK.dll</HintPath>  
</Reference>

(You may need to edit the version numbers to match the version of EMDK for Xamarin you are installing)

    • Edit your .csproj file to add the following reference (shown in context):
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" /> 
<ItemGroup>   
<XamarinComponentReference Include="emdk-component">      
<Visible>False</Visible>       
<Version>2.6.0.70</Version>    
</XamarinComponentReference>  
</ItemGroup>
  • Reload your project within your Visual Studio solution

  You will now have the EMDK for Xamarin component installed in your project as well as access to the Symbol.XamarinEMDK namespace.

 

3.png

 

Applications built from our EMDK Samples

Many people (including myself) prefer to start from a known, working Sample.  EMDK for Xamarin samples are listed on our techdocs support site (http://techdocs.zebra.com/emdk-for-xamarin/2-6/samples/) and because they already have a Xamarin component installed, you do not have to edit the .csproj file.  You might want to update the version of the Xamarin component installed in the sample so these instructions cover that scenario:

git clone https://github.com/Zebra/samples-emdkforxamarin-2_5.git 
cd samples-emdkforxamarin-2_5 git 
checkout ProfileWifiSample1 
  • Open the solution (I had to install API level 19 as I did not yet have that installed, Tools --> Android --> Android SDK Manager)
  • Follow the instructions at the docs site but for completeness I’ll also list the key steps here:
    • Click EMDK from the Visual Studio menu and then ‘Add Xamarin Component’.  This will add the Xamarin component to your local machine in the following location but will NOT add the Xamarin component to your project:
Windows: %LocalAppData%\Xamarin\Cache\Components 
Mac: ~/Library/Caches/Xamarin/Components

menu-install.jpg

    • Right click on the Components option then ‘Edit Components’.  You should see EMDK For Xamarin installed on your machine.  To replace the version in the sample (which may be old) just click ‘Remove’, then ‘Add to Project’ for the newer version.
      • When I did this I got an error saying I must be logged-in to download this component, as detailed in the current Zebra docs.  I then got a 503 error from Xamarin but the component appears to have installed correctly.  You can check this by observing the version of EMDK for Xamarin if you double-click on the component

4.png

The sample application, after clicking 'Edit Components'

5.png

The sample application, after updating to the latest component.

 

Bear in mind that once the EMDK for Xamarin NuGet component is available, these instructions no longer apply.