Luxand FaceSDK – Using with .NET (C# and VB)

First, you need install .NET Framework 2.0 on your system. In Windows Vista/2008/7/8/2012 it can be done by enabling Microsoft .NET Framework 3.0 or 3.5 in Control Panel (Programs and Features – Turn Windows features on or off).

For Microsoft .NET applications, you need to add the .NET component into your project.

Follow these steps to add the component in Visual Studio 2005/2008/2010+:

  • Select Project – Add Reference – Browse
  • For 32-bit applications, choose the file bin\win32\FaceSDK.NET.dll
  • For 64-bit native applications, choose the file bin\win64\FaceSDK.NET.dll
  • Add the following statement to the beginning of your application:

using Luxand

After that you may use the methods of the Luxand.FSDK namespace for general FaceSDK functions, and Luxand.FSDKCam namespace for webcam-related functions. You may refer just to FSDK and FSDKCam namespaces if using Luxand is specified.

Once FaceSDK.NET.dll is added to the references, it will be redistributed automatically with your application, so no specific deployment actions are required. You do not need to redistribute facesdk.dll with your application. However, you need to redistribute Microsoft Visual C++ 2008 SP1 Runtime.

By default, the documentation refers to C/C++ declarations of FaceSDK functions. For example, the function to detect a face is referred to as FSDK_DetectFace function. To refer to this function in .NET, replace the FSDK_ prefix with FSDK. namespace. Thus, the reference to this function becomes FSDK.DetectFace (note that webcam-specific functions are located in the FSDKCam. namespace; refer to Working with Cameras for details).

Note: This .NET component is available in a binary form, compatible with .NET 2.0, 3.0, 3.5, 4.0 and 4.5. To use the component with .NET 4.0 and 4.5 (in Visual Studio 2010, 2012 and higher), just add the useLegacyV2RuntimeActivationPolicy="true" attribute to the <startup> section of the app.config file of your project. If there is no such file in your project, just create the file with the following content:

<?xml version="1.0"?>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0"


If you need a component for a specific .NET version, you may use the source code available in the samples\advanced\.NET wrapper directory. Note that this component is actually a wrapper for facesdk.dll that is linked dynamically, so facesdk.dll must be redistributed with the application that uses this wrapper.


Next chapterUsing CImage class in .NET