Skip to content
This repository was archived by the owner on Feb 22, 2024. It is now read-only.

Installation

Ian Auty edited this page Dec 22, 2017 · 22 revisions

Installation

MMALSharp has support for Mono 4.x, and experimental support for .NET Standard 2.0.

Mono

Installation for Mono differs between the original Model A/B/B+/Zero boards and the newer Pi Model B 2/3 boards running the ARMV7/8 chipsets.

Model A/B/B+/Zero

The version of Mono currently available in the Raspbian repositories is 3.2.8 and isn't compatible with this library. Therefore, we need to do a few extra steps to get a compatible version installed. Luckily, member 'plugwash' from the Raspberry Pi forums has built a version of Mono and provided a repository from which we can install.

In order to install the required version, please open a console window and follow the below steps:

  1. Run sudo nano /etc/apt/sources.list
  2. On a new line, enter deb http://plugwash.raspbian.org/mono4 wheezy-mono4 main
  3. Run sudo apt-get update && sudo apt-get upgrade
  4. Run sudo apt-get install mono-complete

Once completed, if you run mono --version from your command window, you should see the mono version 4.0.2 returned.

Model B 2/3

Using a later model of the Raspberry Pi allows you to install the latest Mono version from the Mono repositories without issue. To do so, please follow the below steps:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb http://download.mono-project.com/repo/debian wheezy main" | sudo tee /etc/apt/sources.list.d/mono-xamarin.list
sudo apt-get update && sudo apt-get upgrade
sudo apt-get install mono-complete

Continued

Once Mono is installed, you can either build the source code yourself (see the Building from Source section below), or grab the latest pre-release build from Myget.

.NET Core

.NET Core is currently available on the Raspberry Pi 2 & 3 boards.

Please note: The install instructions for .NET Core have changed since support was added and are subject to change in the future. The instructions below are up to date as of 11/07/2017. If you're having any issues running MMALSharp on .NET Core, please raise an issue and I'll look into it for you.

Installation

  1. Follow the instructions here on how to create a self-contained application for use on your Raspberry Pi.

  2. In the root of your newly created application, create a NuGet.config file as seen below:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <solution>
    <add key="disableSourceControlIntegration" value="true" />
  </solution>
  <packageSources>
    <!--To inherit the global NuGet package sources remove the <clear/> line below -->
    <clear />

    <add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" />
    <add key="mmalsharp" value="https://www.myget.org/F/mmalsharp/api/v3/index.json" />
  </packageSources>
</configuration>
  1. Open your application's .csproj file and add the following (add another reference for MMALSharp.FFmpeg if you require this functionality). Change the version numbers to the latest found in the MyGet gallery for MMALSharp:
<ItemGroup>    
    <PackageReference Include="Nito.AsyncEx" Version="5.0.0-pre-02" />    	
    <PackageReference Include="MMALSharp" Version="0.3.0.87" />	
</ItemGroup> 
  1. In CMD run dotnet restore at the application root to import the MMALSharp NuGet package
  2. Apply one of the examples to your Program.cs file in your new .NET Core app, adding any namespaces as required.
  3. In CMD run dotnet build to build the application
  4. Run dotnet publish -r linux-arm - this will create a new directory called publish within the debug directory of your new application.
  5. Copy the contents of that folder over to your Raspberry Pi
  6. You should now have a self-contained application that can be ran on your Raspberry Pi. You will probably need to run sudo chmod +x ./APPLICATIONNAME to make it an executable file.

Building from Source

If you wish to build from source, follow the below steps:

  1. Clone the repository by running git clone https://github.com/techyian/MMALSharp.git
  2. In CMD run dotnet restore and then dotnet build.
Clone this wiki locally