The Bait and Switch PCL Trick

Source: The Bait and Switch PCL Trick

I was sure I’ve already blog about it but, apparently, it’s not the case. This post is about a trick to use PCL: you provides a fake implementation in PCL and real implementations, using platform dependent code, for each supported platforms. Then you combine all this implementations in one nuget package.

Doing this way, this nuget package is usable in PCL but fake implementation will never be used. This trick is based on the fact that final application is never PCL and that nuget rules will provides the more specific variant.


Leave a Reply

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

You are commenting using your 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 )

Connecting to %s