Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Portable class library for MonoDroid and MonoTouch

I want to create PCL for MonoDroid and MonoTouch, to share code AES encryption (RijndaelManaged), but Visual Studio wouldn't let me to do so, instead it forces me to add all other frameworks, message is following:

The following frameworks will be selected automatically because they support all of the available functionality that is portable between the other frameworks you have selected: .NET for Windows Store apps, .NET Framework 4.5, Windows Phone 8.

and those frameworks doesn't support System.Security.Cryptography namespace.

Files for MonoDroid and MonoTouch are placed in C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETPortable\v4.5\Profile\Profile78\SupportedFrameworks, witch already contained .NET for Windows Store apps.xml, .NET Framework 4.5.xml, Windows Phone 8.xml.

Can somebody please advice how to isolate Mono frameworks from others, do I need new profile or something else.

like image 447
user2087302 Avatar asked Feb 21 '13 09:02

user2087302


People also ask

What is portable class library?

The Portable Class Library project enables you to write and build managed assemblies that work on more than one . NET Framework platform. You can create classes that contain code you wish to share across many projects, such as shared business logic, and then reference those classes from different types of projects.

What is the difference between the portable class library and shared projects?

The difference between a shared project and a class library is that the latter is compiled and the unit of reuse is the assembly. Whereas with the former, the unit of reuse is the source code, and the shared code is incorporated into each assembly that references the shared project.

What is the difference between .NET Standard and PCL portable class libraries?

NET Standard is a set of curated APIs, picked by Microsoft, PCLS are not. The APIs that a PCL contains is dependent on the platforms that you choose to target when you create a PCL. This makes a PCL only sharable for the specific targets that you choose.


1 Answers

EDIT

This is now automatically done by the installer. You will also need the latest version of nuget.


In fact, all you need to do is add an xml file to the correct folder. Magically a PCL profile called "Mono for Android" will appear.

File name:

MonoAndroid,Version=v1.6+.xml

Put in folder:

C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETPortable\v4.0\Profile\Profile104\SupportedFrameworks

File content:

<?xml version="1.0" encoding="utf-8"?>
<Framework DisplayName="Mono for Android"
  Identifier="MonoAndroid"
  Profile="*"
  MinimumVersion="1.6"
  MaximumVersion="*" />

For more information look at the mvvmcross project https://github.com/slodge/MvvmCross

like image 64
Softlion Avatar answered Oct 21 '22 06:10

Softlion