Skip to content

Step 2: Setup UA-ModelCompiler in Linux

Last updated on October 15, 2020

Setup the UA-ModelCompiler on Linux to compile ModelDesign files to UANodeSet files.

This Post is part of the OPC UA Information Model Tutorial.


Instead of compiling ModelDesign files on Linux, the following alternative workflows are available:

Compile the ModelDesign file on MS Windows (Setup UA-ModelCompiler on Windows)

Instead of editing ModelDesign files and compiling them into UANodeSet files, edit of UANodeSet files directly with appropriate editors: Setup NodeSet Editor


This guide strongly recommends editing and compiling ModelDesign files over direct editing of UANodeSet files. Although ModelDesign files are not part of the OPC UA standard (UANodeSet are part of the standard) they are part of the toolchain used by the OPC Foundation to generate official UANodeSet files. Following the example set by the OPC Foundation will result in a more sustainable, reproducible and stable workflow overall.

Using a Docker Container

If you are on Linux, I strongly recommend to use the precompiled docker container available on DockerHub:

git clone
cd opcua-animal-cs
docker run \
	  --mount type=bind,source=$(pwd),target=/model/src \
	  --entrypoint "/app/" \
	  sailavid/ua-modelcompiler:opcua_rocks_tested \
	   /model/src/animalModel animal /model/src/Published

This will build the model and copy it into opcua-animal-cs/Published/animal:

  • animal.Classes.cs
  • animal.Constants.cs
  • animal.DataTypes.cs
  • animalModel.csv
  • animalModel.xml
  • animal.NodeSet2.xml
  • animal.NodeSet.xml
  • animal.PredefinedNodes.uanodes
  • animal.PredefinedNodes.xml
  • animal.Types.xsd
  • animal.Types.bsd

Compile the Model Compiler on Linux

Instead of using the pre-compiled docker container, you can also clone the official UA-ModelCompiler repository and build the C# code using mono:

git clone
cd UA-ModelCompiler

Install mono and nuget:

sudo apt install mono-devel mono-complete
cd UA-ModelCompiler
mono nuget.exe install -OutputDirectory packages ModelCompiler/packages.config

Then you can build the ModelCompiler using mono, which will create a .exe file that can be executed on linux (Bin/Debug/Opc.Ua.ModelCompiler.exe)

msbuild "ModelCompiler Solution.sln" /p:TargetFrameworkVersion="v4.5"
Error during compilation?

If you get the following error “Could not resolve type with token 01000195”, then you probably need to update your mono installation (see comments below).

I strongly recommend to use the provided script here:

This gives you a simpler interface to the model compiler:

./ $DIR/animalModel animal $DIR/Published

The first argument is the path to the ModelDesign xml file, without extension. The second argument is the prefix for the generated NodeSet2 files. The last argument is the output directory.

Example usage is shown here:

Published inInformation Modeling


  1. Marco Kreft Marco Kreft

    thanks for this tutorial. I havent finished it jet but it seems all in all very helpful!
    I just want to leave a quick hint on the “mono nuget.exe install -OutputDirectory packages ModelCompiler/packages.config” command from above:
    – there I was getting the error “Could not resolve type with token 01000195”.
    I found the solution by updating mono to the latest version via: This might seem redundant to some folks but since it wasnt to me there might be the chance that some else will find it helpful to know 🙂

    Thank you again for all the hard work.


  2. Siegfried Gipp Siegfried Gipp

    i’m currently trying this step 2. I managed to install the correct version of mono in my Linux VM, and got nuget.exe. Now when i try to build the model compiler, i first get a warning from every package in packages.config, then an error of every package.
    The warnings are like:

    Restoring NuGet package Csv.2.0.62.
    WARNING: Unable to find version ‘2.0.62’ of package ‘Csv’. Unable to load the service index for source
    GSSAPI operation failed with error – An invalid name was supplied (Configuration file does not specify default realm).

    Then the error messages are like:
    Unable to find version ‘2.0.62’ of package ‘Csv’. Unable to load the service index for source
    GSSAPI operation failed with error – An invalid name was supplied (Configuration file does not specify default realm).

    I can download the file though. So i doubt that this is a permission problem. It seems to be something different.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.