Click here to Skip to main content
Click here to Skip to main content

PCL Targets for Mono / MonoGame Projects

, 6 Apr 2013
Rate this:
Please Sign up or sign in to vote.
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 version="1.0" encoding="utf-8"?>
<Framework DisplayName="Mono for Android"
  Identifier="MonoAndroid"
  Profile="*"
  MinimumVersion="1.6"
  MaximumVersion="*" />

MonoTouch,Version=v1.0+ .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)

About the Author

Simon Jackson
Architect ZenithMoon Studios
United Kingdom United Kingdom
Long time game developer / IT maniac.
By day working as a lowly Technical Architect for a healthcare software firm, by night Masquerading as the Master Chief of ZenithMoon Studios.
 
At heart I'm 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 AdRotator advertising rotator project for Windows and Windows Phone.
 
After a hefty break with Windows Phone and Windows 8 I'm heading back to my XNA roots to show how beginners and current XNA devs can take their skills forward with XNA's bleak future.
Follow on   Twitter   Google+

Comments and Discussions

 
GeneralMy vote of 5 PinmemberMihai MOGA10-May-13 18:35 
GeneralRe: My vote of 5 PinmemberSimon Jackson12-May-13 12:03 
QuestionI vote 5 Pinmembercjhazard26-Apr-13 23:59 
AnswerRe: I vote 5 PinmemberSimon Jackson12-May-13 12:02 
GeneralMy vote of 2 Pingroupramanujkumar10-Apr-13 20:28 
GeneralRe: My vote of 2 PinmemberSimon Jackson11-Apr-13 10:30 

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

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

| Advertise | Privacy | Mobile
Web02 | 2.8.140718.1 | Last Updated 7 Apr 2013
Article Copyright 2013 by Simon Jackson
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid