kaycee kaycee - 1 month ago 4x
C# Question

Install MVVMCross plugin in UWP failure

i am trying to install MVVMCross plugin in UWP project but it seems to fail.

in the PCL it seems to be working fine, but in the UWP I'm expecting that the plugin will create a Bootstrap folder and it doesn't happen.

I even started a new project from scratch named it "TipCalc.WindowsUWP", installed the MVVMCross and then the JSON plugin using NuGet and nothing happens.

the output of the plugin installation looks fine:

Restoring packages for 'TipCalc.WindowsUWP'.
Restoring packages for C:\Users\kayce\Documents\Visual Studio 2015\Projects\TenBisServer\MvvmCross\TipCalc\TipCalc.WindowsUWP\project.json...
Package restore completed successfully for 'TipCalc.WindowsUWP'.
Successfully installed 'MvvmCross.Plugin.Json 4.2.3' to TipCalc.WindowsUWP
========== Finished ==========

what I am missing ?


This is expected behavior, as a UWP project uses a project.json (NuGet 3) template. Currently all additional content and scripting specified in the NuGet package with have no affect on your project when including a package (See Changes affecting existing packages).

You will have to manually add the bootstrap folder and relevant plugin bootstrap .cs file, or you can register the interface and implementation of the plugin in your Setup.cs.

Bootstrap Approach:

using MvvmCross.Platform.Plugins;

namespace <<YOUR_NAMESSPACE>>.Bootstrap
    public class JsonPluginBootstrap
        : MvxPluginBootstrapAction<MvvmCross.Plugins.Json.PluginLoader>

Setup.cs Approach:

protected override void InitializeLastChance()
        Mvx.RegisterSingleton<IMvxJsonConverter>(new MvxJsonConverter());