Click here to Skip to main content
15,867,328 members
Articles / Mobile Apps / iOS

PCL Targets for Mono / MonoGame Projects

Rate me:
Please Sign up or sign in to vote.
4.70/5 (3 votes)
6 Apr 2013CPOL3 min read 16.9K   7   6
PCL targets for Mono / MonoGame projects

Introduction

I’ll be blogging over the next few weeks about my involvement with the MonoGame project in the dark dark backgrounds, all around the area of PCL support within the project.

I’ve been focusing on two aspects:

  • Spiting up the MonoGame code base into two parts, the first part containing all code that will work on any platform without modification and the second part containing platform specific code that today is managed with #if statements to target each platform
  • Creating a full PCL MonoGame Project which can be used to build games against that will work on any platform without worrying about platform specifics. (my previous post about portable MonoGame gave an overview on this)

Now in order to use PCL projects in development, you must enable your development environment to be able to target Mono platforms. For Windows based solutions, Visual Studio already enables you to target .NET / Silverlight environments, with the Phone SDK you can also include Windows Phone and with Win8 / VS2012 you get Store app support out of the box.

For Mono platforms such as iOS and Android however, you need to enable these manually (at least until Xamarin studio comes out with official support)

*Note, yes you will need to install either Mono or Xamarin Studio to enable Mono platform targeting support.

Worry not young Padawan, this process is very easy!


The PCL Target Files

The first easy part is to create the PCL target files, one for each Mono platform, just open up Notepad and create the following files:

MonoAndroid,Version=v1.6+.xml

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

MonoTouch,Version=v1.0+ .xml

XML
<?xml version="1.0" encoding="utf-8"?>
<Framework DisplayName="Mono for iOS"
  Identifier="MonoTouch"
  Profile="*"
  MinimumVersion="1.0"
  MaximumVersion="*" />

Alternatively, you can download the files from here.


Installation

Now for the really tricky part, installation, this really challenging and hard to master process needs to be attempted many times before you can become proficient at it.

You need to COPY the files into a folder!, try not to be too daunted by this task. Open-mouthed smile

Take the above files you have created and copy them to the following folder:

x64 Development Machine

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

x32 Development Machine

C:\Program Files\Reference Assemblies\Microsoft\Framework\
.NETPortable\v4.0\Profile\Profile2\SupportedFrameworks

Now on some machines / environments, you might also need to put the files into an additional / alternative folder. The reason being the profile that is used by PCL projects on your development machine, I’m sure there is a perfectly good reason for this yet the answer eludes me, so if the above doesn’t work, then you need to copy the files into the folder for profile 104 instead of 2, as follows:

x64 Development Machine

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

x32 Development Machine

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

Done!


You’re Ready

Now your development environment is setup to work with PCL support for all of Mono / MonoGame’s supported platforms.

image

*Note

If you select XBOX360 as an additional framework to support due to its very restricted nature, you will now be able to enable Mono platforms. Also it renders the scope of what you can have in a PCL project to next to nothing. Best advise, keep XBOX projects separate and use “Copy” projects to support that platform.


Coming Up Next

I’ve taken my leave of work for the next few weeks (nice Easter break from work) and plan to re-up my blogging efforts with my activities of late with MonoGame and other projects, this includes:

The splitting up of MonoGame

How-to : Use MonoGame PCL to build games

A book review of the excellent “Kinect for Windows SDK Programming Guide” by Abhijit Jana

The AdRotator V2 roadmap & progress

All that as well as have a play around with the new Unity3D SDK’s for Windows Phone and Windows 8 plus many other personal projects, should be a fun holiday (provided I get permission from the wife Smile with tongue out).

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Architect ZenithMoon Studios
United Kingdom United Kingdom
Long-time game developer / IT maniac.
By day I architect, design, build and deliver enriching Mixed Reality solutions to clients, bringing the work of AR/VR to light in new and interesting ways, by night I Masquerade as the Master Chief of ZenithMoon Studios, my own game development studio.

At heart, I am a community developer breaking down lots of fun and curious technologies and bringing them to the masses.

I'm also a contributor to several open-source projects, most notably, the Reality Toolkit and all the services provided by the Reality Collective, The Unity-UI-Extensions project, as well as in the past the AdRotator advertising rotator project for Windows and Windows Phone.

Currently, I spend my time fulfilling contracts in the Mixed Reality space (primarily for an XR experience firm called Ethar), writing books, technically reviewing tons of material and continuing my long tradition of contributing to open-source development, as well as delivering talks, but that goes without saying Big Grin | :-D

Mixed Reality MVP, Xbox Ambassador, MS GameDevelopment Ambassador & Best selling author:

[Accelerating Unity Through Automation](https://www.amazon.co.uk/Accelerating-Unity-Through-Automation-Offloading/dp/1484295072/ref=rvi_sccl_3/262-0817396-1418043)
[Mastering Unity 2D Game Development] (https://www.packtpub.com/game-development/mastering-unity-2d-game-development)
[Unity 3D UI Essentials] (https://www.packtpub.com/game-development/unity-3d-gui-essentials)

Comments and Discussions

 
GeneralMy vote of 5 Pin
Ștefan-Mihai MOGA10-May-13 18:35
professionalȘtefan-Mihai MOGA10-May-13 18:35 
GeneralRe: My vote of 5 Pin
Simon Jackson12-May-13 12:03
Simon Jackson12-May-13 12:03 
QuestionI vote 5 Pin
Greedy Goblin Games26-Apr-13 23:59
Greedy Goblin Games26-Apr-13 23:59 
AnswerRe: I vote 5 Pin
Simon Jackson12-May-13 12:02
Simon Jackson12-May-13 12:02 
GeneralMy vote of 2 Pin
ramanujkumar10-Apr-13 20:28
ramanujkumar10-Apr-13 20:28 
GeneralRe: My vote of 2 Pin
Simon Jackson11-Apr-13 10:30
Simon Jackson11-Apr-13 10:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.