Live Reload from Visual Studio 2017 for Windows in WMWare Fusion on a Mac – Xamarin

main-qimg-2f9592a9947bee2a14921ac6cadfe091If you’re one of those people with a Mac but LOVE Visual Studio for Windows, here’s how you can set up Live Reload to work.

As you may know the Android Emulator can’t run in VMWare fusion, so you need to connect to it. Here’s how.

First install the Visual Studio for Windows Live Reload Extention and the Nuget package into your app as per instructions on the Live Reload site.

Here are the tweeks needed after that.

In your App.xaml.cs add this line at the top, DO NOT add any MQTT settings:

public partial class App : Application
   public App()

Open Tools – Options then add the Hostname and unselect the checkbox as in the picture below.

Rebuild and redeploy the app to Android and iOS.

Now you can edit XAML and see changes live in both at the same time (mind blowen)


Using Android Emulator from Windows in WMWare Fusion on a Mac – Xamarin

download.jpgYou can’t run Android in a VM so if you are running Windows on a Mac using VMWare Fusion, you’ll need to connect to the Android running on the Mac. More detail

Once you have installed Visual Studio for Mac, open it and run the emulator for Android.

On the Mac

Open a Terminal on your Mac and enter this to add the Android platform tools into the path:

echo ‘export PATH=$PATH:~/Library/Developer/Xamarin/android-sdk-macosx/platform-tools/’ >> ~/.bash_profile
source ~/.bash_profile
adb devices

If you get a permission error on the bash_profile, run this:

sudo chown YOURACCOUNTNAME ~/.bash_profile

You should see a nice list of the emulators running. That will show you that you have completed the first step. You do not need to ever run this again.

Screen Shot 2018-07-05 at 9.03.31 AM.png

Open TextEdit and add this as a text file:

echo ‘Starting android pipe listener’
cd /tmp
mkfifo backpipe
nc -kl 5555 0<backpipe | nc 5555 > backpipe

In TextEdit go to the Format menu and choose Make Plain Text

In TexEdit save the file to your desktop but without the .txt extension. Note that we unchecked the .txt extension

Screen Shot 2018-07-05 at 9.20.27 AM.png

We now need to tell OSX that the file is an executable. Open Terminal and use the following command and path (yours will be a bit different than mine)

chmod 700 /Users/<your account>/Desktop/adb

Now we can run it by double clicking the adb file. This should will run in the background always. so many sure it’s run when you want to connect to Android from the Windows VM

Screen Shot 2018-07-05 at 10.41.07 AM.png

Screen Shot 2018-07-05 at 9.25.24 AM.png

On the PC

Now that you are running the bash script on the Mac, it’s ready to be connected to.

Add a Windows Batch file on your desktop there with the following. Run it one to have the connection set up. It will appear then disappear. If you loose connection, then run it again.

cd C:\Program Files (x86)\Android\android-sdk\platform-tools
adb.exe connect <IP address of the Mac, get it from the Mac Settings app-> network>

You’ll see the Android device in your Visual Studio:

Screen Shot 2018-07-05 at 11.05.24 AM.png



If when you use the adb devices command on the PC, you get an “unauthorized” go check the running android and ensure it isn’t asking for permission. If it is, grant it then run both script on the Mac and PC to re-establish connection.

Kendo Controls in an AngularJS ng-repeat

Mark_verticalKendo has long been an awesome JavaScript framework for UI controls. I had to build a user management system and needed to dynamically show a number of Kendo controls, all created via an AngularJS ng-repeat.

Kendo is smart enough to know that the item in the repeat, a user in this case, is the bound object and will keep a reference to it.

<div  ng-repeat="user in model.users">
        <input kendo-numeric-text-box
               k-min="0" k-max="10000000"
               k-ng-model="user.wealth" />


ASP.Net Core 2: Quick and Dirty Windows Authentication

410329-636167162756711825-16x9.jpgHere’s the bare minimum you need to add to your ASP.Net Core 2 application to restrict it to certain Windows Active Directory groups.




Step 1: Enable Windows Authentication in the Project Properties:


Step 2: add this to your Web.Config <aspNetCore> node:

 <aspNetCore forwardWindowsAuthToken="true"

Step 3: Enable Windows Authentication in IIS


Step 4: Add Authentication to the ConfigureServices call in your Startup.cs

        public void ConfigureServices(IServiceCollection services)
            // IISDefaults requires the following import:
            // using Microsoft.AspNetCore.Server.IISIntegration;
            services.Configure<IISOptions>(options => {
                options.AutomaticAuthentication = true;
                options.ForwardClientCertificate = true;

Step 5: Add this to your Configuration call in Startup.cs


Step 6: Add [AllowAnonymous] to Controllers which need anonymous access

Step 7: Add [Authorize(Roles…)] to controllers that need to be restricted

namespace App.Web.Areas.Kxg.Controllers
    [Authorize(Roles = "MyAD\\Developer,MyAD\\IT_Support_Desk_Staff ")]
    public class CustomerSearch : Controller


To get a list of the Groups used in [Authorize], in PowerShell type:

whoami /groups


ASP.Net Core 2: Shared Localization

main-qimg-82f43ebb6d5b671466ae8fbce0195735.pngIn this post we’ll cover the absolute simplest way to localize using a shared resource instead of one resx per controller. Here’s a good deep dive as there is much more to know, but this will get you going.

Step 1: Set up the Startup.cs

public void ConfigureServices(IServiceCollection services)
        opts =>
            var supportedCultures = new List<CultureInfo>
                new CultureInfo("en"),
                new CultureInfo("fr"),
            opts.DefaultRequestCulture = new RequestCulture("en");
            // Formatting numbers, dates, etc.
            opts.SupportedCultures = supportedCultures;
            // UI strings that we have localized.
            opts.SupportedUICultures = supportedCultures;

Step 2: Then update Configure()

public void Configure(IApplicationBuilder app, IHostingEnvironment env)
    var options = app.ApplicationServices

Step 3: Add a folder called “Resources” to the web project. NOT in an external project. Add these three resx files.

2018-05-27 09_35_12-Window.png

Step 4: Reference the shared resource in your controller

public class PickersController : Controller
    private readonly IStringLocalizer<Startup_localizaer;
    public PickersController(IStringLocalizer<Startup> localizaer)
        _localizaer = localizaer;
       var someString =  _localizaer["Your Key from Resx"];


Visual Studio: Bower is Dead Long Live LibMan

rip_bower.pngSo, Bower is dead for Visual Studio.  NPM and WebPack are external tools and overkill if all you really want to do is add a simple open source project like Bootstrap-Datepicker.

As of Visual Studio 2017.7, you can use a Visual Studio tool to get client side libraries.

The goal of this tutorial is to include Bootstrap-Datepicker, a popular javascript open source project.

Step 1: Turn on Library Manager by right clicking the Project and choosing Manage Client-side libraries


A new file called LibMan.json is added. If you open it you’ll see this:


By default LibMan.json uses the content provider “CDNJS” to provide the JS. Other providers are available. Remember this isn’t a CDN, it’s just where to download the JS from.

Let’s add a defaultDestination for our packages:


Step 2: To add a library, go to and find the package, for example:

We now know the name of the package “bootstrap-datepicker”.  Add that and use a @ at the end to get intellisence for the version number:


Save the file, then right click libman.json and choose Enable Restore on Build to have a NuGet package added which will cause MSBuild to download JS packages.

Build the solution and you’ll see bootstrap-datepicker.js added.


That’s the fastest way to get started, here’s some more documentation for finer control.



NuGet servers requiring username/password in VSTS

nuget.jpgWhen you buy a tool for your development, sometimes that tool comes via a private NuGet server which often requires a username and password.

In order to access the server, you’ll need to add these credentials to VSTS. To do this, click the Gear, then Services.


Click New Service Endpoint, then choose NuGet from the list that appears.



On the dialog that appears, select Basic Authentication and enter the details for the external NuGet server.


Now go to your build definition, and choose the NuGet restore build setup you have already added there. Under Feeds and authentication, choose Feeds in my NuGet.config and enter the path to your nuget.config in the solution.

Then choose the credentials you just added in the following box.


Happy Building!