In order for your application to run on the end-users system you must redistribute the relevant ENCX components. This document describes what you need to do.
If you are using the Windows Installer mechanism to distribute your application then the easiest way to redistribute the ENCX components is to use the supplied Merge Module. Use your installer creation tool (e.g. Installshield) to incorporate the merge module into you main installer (see the tools documentation for details on how to do this).
Your installer will now automatically perform all the steps necessary to setup ENCX on the target machine and will also correctly uninstall the ENCX components when the end-user uninstalls your application.
If you are not using the Windows Installer mechanism to distribute your app (or just want to have control over what is going on) your installer can set up ENCX itself. ENCX comes as two DLLs, and you need the one that matches your application:
To set up ENCX for all users (must be run as an administrator):
To cleanly remove the ENCX components from the system follow these steps
From ENCX 5.6, an installer that cannot run as an administrator can register ENCX for the current user only. For a 32-bit application:
regsvr32 /n /i:user EncXCOM.dll
and for a 64-bit application:
regsvr32 /n /i:user ENCX64.dll
To unregister it, add /u, e.g. regsvr32 /u /n /i:user EncXCOM.dll.
Only that user's processes see the registration, and it takes precedence over a machine-wide registration of ENCX. Processes running as an administrator (elevated) do not see it, so an application that the user runs elevated needs a machine-wide registration.
See also registering ManageENC.
An application can use ENCX without it being registered at all, by copying the DLL into the application's folder and naming it as a dependency in the manifest embedded in the application's executable.
A 32-bit application copies EncXCOM.dll and has this manifest (with your own application's name in the first assemblyIdentity):
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity name="MyCompany.MyApplication" version="1.0.0.0" type="win32" processorArchitecture="x86" />
<dependency>
<dependentAssembly>
<assemblyIdentity name="EncXCOM" version="3.0.0.0" type="win32" processorArchitecture="x86" />
</dependentAssembly>
</dependency>
</assembly>
A 64-bit application copies ENCX64.dll and has this manifest:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity name="MyCompany.MyApplication" version="1.0.0.0" type="win32" processorArchitecture="amd64" />
<dependency>
<dependentAssembly>
<assemblyIdentity name="ENCX64" version="3.0.0.0" type="win32" processorArchitecture="amd64" />
</dependentAssembly>
</dependency>
</assembly>
The name, version and processorArchitecture must match the DLL exactly: a 64-bit application that names EncXCOM, or a 32-bit one that names ENCX64, fails to start with a side-by-side configuration error. The version is that of the ENCX type library, not of ENCX itself, so updating ENCX does not mean changing the manifest unless its interfaces change incompatibly. In a .NET Framework or .NET 10 project, set ApplicationManifest to the manifest file; a project built for Any CPU must be built for x86 or x64 instead, as the manifest names one of the two, and a .NET 10 project also needs RuntimeIdentifier set to win-x86 or win-x64 so that its executable has the same bitness as the manifest.
The application then creates ENCX objects, including by ProgID, without anything in the registry, and each application can have its own version of ENCX. This only works for an application whose manifest you control, so not for a script or a VBA project hosted by another application such as Microsoft Access.
The SxS-Framework (.NET Framework) and SxS-Core (.NET 10) samples, in the SideBySide samples folder, are complete C# examples, with x86 and x64 builds. See Notes About Samples.
You will need to distribute the interop file Interop.ENCX.dll - this should sit alongside your .NET assembly.
If you are developing an application in a .NET language and you are using the .NET controls provided with the ENCX SDK then you need to redistribute the relevant assembly (ENCXControls.dll). Your installer needs to place this assembly in the same location as your executable on the target machine.
If you wish to use the ENCXControls.dll assembly in more than one application without installing a private copy alongside each then you can compile your own version from the supplied source code and give it a strong name using sn.exe (included with the .NET Framework SDK). This will allow you to install the assembly into the Global Assembly Cache. (See Working with Assemblies and the Global Assembly Cache on MSDN).
An alternative way of using the .NET Controls is to directly include their supplied source code into your project. This give you the flexibility to alter the controls if required and means there need not be a separate assembly to distribute.