The Interaction Library SDK is distributed with 32 bit and 64 bit C# assemblies for Windows, and 64 bit for Linux, macOS and Android. Let's assume we have downloaded a zip file with the SDK version for Windows with a dynamic 64 bit library. We can now unzip this into a directory of our choice, for example C:\src
, so that we there have this content:
We will now build the C# sample located in samples\cs
, using the .NET Core toolset. The Interaction Library C# assembly is referenced properly in the sample .csproj file.
Assuming that our command line build environment is properly set up, this is what we will see when running the dotnet
utility command (building, publishing, running, etc., is handled by it) without any command line options:
To build the C# sample project in samples\cs
, this is the command line we need:
The output from dotnet
is the assembly cs_sample.dll
in samples\cs\bin\Debug
, which we now can run from the command line:
If a Tobii eyetracker is plugged into the computer, we will see gaze focus events getting printed to the command window.
NOTE! If we instead download the SDK with a 32 bit dynamic library for Windows, dotnet build
will require the parameter -r win-x86
, and the output will be in samples\cs\bin\Debug\win-x86
. Running it will additionally require installation of the x86 .NET Framework, and the full path to the x86 dotnet.exe must be used:
Building the sample in Visual Studio is a s simple as opening, building and running samples\cs\cs_sample.csproj
.
NOTE! If we instead download the SDK with a 32 bit dynamic library for Windows, before opening and running samples\cs\cs_sample.csproj
in Visual Studio, open it in an editor and change <CurrentPlatform>x64</CurrentPlatform>
to <CurrentPlatform>x86</CurrentPlatform>
. The path to the x86 dotnet.exe (C:\Program Files (x86)\dotnet\dotnet.exe) must be put before the path to the x64 dotnet.exe (C:\Program Files\dotnet\dotnet.exe) in the system environment variable PATH
for Visual Studio to launch the correct one for x86.
Open the samples\cs
folder with File > Open Folder.... If this is the first time the folder is opened, VS Code will show the question "Required assets to build and debug are missing from 'cs'. Add them?". Choose Yes here and select cs_sample
when asked what project to launch. VS Code creates build tasks and launch configurations for cs_sample
. Build the project with Terminal > Run Build > Task... > build. Before running the application, go to Run > Open Configurations and remove netcoreapp2.0
from "${workspaceFolder}/bin/Debug/netcoreapp2.0/cs_sample.dll"
. Then run the application with Run > Start Debugging or Run > Run Without Debugging.
NOTE! If we instead download the SDK with a 32 bit dynamic library for Windows, before building and running cs_sample.csproj
in VS Code, open it and change <CurrentPlatform>x64</CurrentPlatform>
to <CurrentPlatform>x86</CurrentPlatform>
. The path to the x86 dotnet.exe (C:\Program Files (x86)\dotnet\dotnet.exe) must be put before the path to the x64 dotnet.exe (C:\Program Files\dotnet\dotnet.exe) in the system environment variable PATH
for VS Code to launch the correct one for x86.
The contents of the sample file samples\cs\cs_sample.cs
is looked at in detail in the Sample walkthrough