OxyPlot in Xamarin Studio

Oystein Bjorke 10 years ago 0
This discussion was imported from CodePlex

tyoung87 wrote at 2014-03-19 21:37:

How do I set up Xamarin Studio to use Oxyplot for Android? I've scoured the internet and tried multiple things myself and I can't figure it out. A simple, step by step walkthrough would be wonderful. Thanks ahead of time.

objo wrote at 2014-03-19 22:44:

I am currently preparing a Xamarin component for both iOS and Android. This should include some simple instructions how to get started. In the meantime you can look at the OxyPlot.XamarinAndroid solution.

tyoung87 wrote at 2014-03-20 18:01:

So doing further research into this, I've found some info that other people in my situation should know. If you try to open the OxyPlot.XamarinAndroid solution in Xamarin Studio, you will receive the following errors:

Could not load project 'OxyPlot\OxyPlot.csproj' with unknown item type '{786C830F-07A1-408B-BD7F-6EE04809D6DB}'
Could not load project 'Examples\ExampleLibrary\ExampleLibrary.csproj' with unknown item type '{786C830F-07A1-408B-BD7F-6EE04809D6DB}'

if you google 786C830F-07A1-408B-BD7F-6EE04809D6DB, you will find these pages:

http://stackoverflow.com/questions/10802198/visual-studio-project-type-guids
http://stackoverflow.com/questions/14515007/vs-2010-sp1-the-project-type-is-not-supported-by-this-installation

Which lets you know that this is an issue with Portable Class Libraries, and specifically deals with not having the Portable Library Tools installed. Now according to this page, it's possible to use Portable Library Tools in Xamarin Studio:

http://forums.xamarin.com/discussion/12105/pcl-in-xamarin-studio

But according to this page, the only way to install Portable Library Tools is to first have Visual Studio 2010 SP1 Pro or later installed:

http://msdn.microsoft.com/en-us/library/vstudio/gg597391(v=vs.100).aspx

So, plain and simple, the only way to use Oxyplot for Android or iOS before the component is officially released is if you have a copy of Visual Studio 2010 SP1 Pro or later installed so that you can build the project (or get someone else that does have it to build it for you). Past that, you're out of luck.

tyoung87 wrote at 2014-03-20 18:58:

Little more info. It actually is possible (I think). Portable Library Tools can be installed on a computer without Visual Studio on it if you run the installer from the command line and add the /buildmachine switch. See here for documentation:

http://msdn.microsoft.com/en-us/library/vstudio/gg597391(v=vs.100).aspx

tyoung87 wrote at 2014-03-20 21:11:

So I think that I've just about got this all figured out. So with just the Portable Library Tools, you'll run into issues about not having .net portable v4.0 profile 136. To get around this issue as well as the others, here's what you need to do:
  1. Download Portable Library Tools 2 from here: http://visualstudiogallery.msdn.microsoft.com/b0e0b5e9-e138-410b-ad10-00cb3caf4981/
  2. Use the command line to run: PortableLibraryTools.exe /buildmachine
  3. Download the Microsoft .NET Portable Library Reference Assemblies 4.6 from here: http://www.microsoft.com/en-us/download/details.aspx?id=40727
  4. Run the exe file.
  5. Running the exe file will put the file PortableReferenceAssemblies.zip here: C:\Program Files (x86)\Microsoft .NET Portable Library Reference Assemblies 4.6
  6. Extract the zip file to C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETPortable (this is where you get profile 136)
  7. Install Xamarin Studio and Xamarin.Android
  8. Download and install StyleCop from here: https://stylecop.codeplex.com/releases/view/79972
  9. Download the Oxyplot source code and open the solution in Xamarin Studio and build it.
At this point everything should be building without error.

objo wrote at 2014-03-25 21:03:

Thanks for the detailed explanation! I was not aware that this was a problem. I will add this to the build notes.
Note: On Mac you only need Xamarin Studio, no need to install any extra components :-)
I hope we can get the Xamarin components up and running soon.