Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Directly using plugin's source in my application?

$
0
0

I need to modify Plugin.BLE for my application. I already have a working application that uses the NuGet package. So, I tried migrating the application code to a copy of the plugin's source, which includes a solution with a couple example projects. Unfortunately, the examples use the included MVVM code, which I don't want to use for my project. I can't get my non-MVVM ("vanilla usage") code to reference the plugin's source correctly.

To access the class, in the portable code, I use the given vanilla line
var ble = CrossBluetoothLE.Current;
which works fine when using the NuGet package, but now, it looks like the source, as part of its initialization, calls
static IBluetoothLE CreateImplementation()
{
#if PORTABLE
return null;
#else
var implementation = new BleImplementation();
implementation.Initialize();
return implementation;
#endif
}
Here's the class definition file, in case I'm leaving something important out.

Since PORTABLE is defined for the portable code, that return null; results in this runtime exception:
"This functionality is not implemented in the portable version of this assembly. You should reference the NuGet package from your main application project in order to reference the platform-specific implementation."

How do I get the portable code to reference the platform-specific projects, which can also can (and apparently must) initialize the class? This MSDN article says "publishing [libraries] as NuGet packages allows consumers to reference the different components of the library as one unit." Is that what I'm taking advantage of in my original package-referencing project? If so, how do I replicate that without an actual package?


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>