The C#/.Net version of the OpenEye Toolkits is a P/Invoke wrapper created using SWIG. It is important to note that this is not a new version of the toolkits written in C# nor is it a C# interpretation of the toolkit API, but a rather faithful reproduction of the toolkit API in C#. And while this manual is specific to C#, the version of the toolkits works with all .Net languages include Visual Basic .Net, F# and IronPython.
A few of the idiomatic differences include:
- There are relatively few classes in OEChem and they have a rather shallow inheritance hierarchy.
- Most OEChem algorithms are in C++ free functions. These are mapped to static methods in the class OEChem.
- C# doesn’t support all the operator overloading of C++, so some C++ operators are mapped to methods. For example, “operator bool()” is mapped to a member function called “IsValid()”, “operator()” is mapped to “Call()”.
In order to use the OpenEye toolkits with C#/.Net, you need a copy of Visual Studio. We currently support VS2015, VS2017, and VS2019 including the free “Express” versions.
For deployment of toolkit programs built with VS2015 onto older systems, one may need to download and install the redistributable VS2015 runtime, available at: https://www.microsoft.com/en-us/download/details.aspx?id=48145 Otherwise one may get messages at execution-time about missing files: msvcp140.dll, vcruntime140.dll and related files.
The following minimum versions of the VS2017 compiler(s) are recommended:
Microsoft Visual Studio Community 2017 Version 15.9.7 VisualStudio.15.Release/15.9.7+28307.423 Microsoft .NET Framework Version 4.7.03190
Microsoft Visual Studio Professional 2017 Version 15.9.4 VisualStudio.15.Release/15.9.4+28307.222 Microsoft .NET Framework Version 4.7.03062
A license file from OpenEye Scientific Software is required to run any OpenEye toolkit. A license file can be requested/obtained by contacting OpenEye at firstname.lastname@example.org.
At startup, the toolkit looks for a valid license in the following default locations:
In a file specified by the environment variable OE_LICENSE.
In a file named oe_license.txt in the directory specified by the environment variable OE_DIR.
In a file named oe_license.txt in the user’s platform-specific local OpenEye application data directory. The location of this directory is detailed below:
In a file named oe_license.txt in the current working directory
License failure results in fatal error. The examples in OEChemIsLicensed show how to check if a valid license is available.
Download the OpenEye .Net distribution¶
The distribution is obtained from http://www.eyesopen.com/downloads. Once you have a license file with the “clr” feature for the toolkits, you can download a distribution. There is a 64-bit download for each supported version of Visual Studio.
Each distribution is provided as ZIP file, that you can simply extract. Inside the C#-Examples folder, you will find a pair of folders for each toolkit. One for the main examples and one for the documentation examples. Each sub-folder contains a solution (.sln) file appropriate for your chosen Visual Studio version.
The Global Assembly Cache¶
If you desire to install all the OpenEye assemblies into the Global Assembly Cache, there is a convenience script included in the Scripts directory. Double-click on Install_to_GAC.bat to install all the assemblies.
If you need to uninstall the assemblies for some reason, simply double-click on Uninstall_from_GAC.bat.
There is no requirement to install anything into the GAC. If you are not sure you need this, you probably don’t.