M‑Files API version and CLR assembly updates¶
The M‑Files API is embedded in the Connector database as CLR assemblies. The API version in those assemblies must match the M‑Files client installed on the SQL Server. If the client is upgraded without refreshing the assemblies, the Connector fails to load the API.
Note
Release 5.13.38.82 reworked how the Interop assembly is located and how reloads are triggered — see M-Files Interop Loading Redesign (Release 5.13.38.82) for full release notes. This page describes the current (post-5.13.38.82) behaviour.
Where the Interop assembly is loaded from¶
spMFUpdateAssemblies resolves Interop.MFilesAPI.dll dynamically
at runtime, independent of any fixed install-layout assumption:
If an M‑Files client is detected on the SQL Server (via the registry under
HKLM\SOFTWARE\Motive\M-Files), the assembly is loaded from that client’s install path.If no M‑Files client is present, the procedure falls back to the MFSQL-managed
AssemblyInstallPathfolder, where the DLL is placed by the Connector installer.
This means the Connector survives M‑Files folder-layout changes between versions
without code changes or manual path reconfiguration. The legacy MFInstallPath
setting in MFSettings is no longer used for this resolution — see
Deprecated settings below.
Automatic monitoring and updates¶
Since 5.13.38.82, three layers keep the assemblies in sync with the installed M‑Files version, from fastest to most conservative:
WMI Event Alert (immediate). Job MFSQL `<database>` — Set Assembly Update Flag — fires within seconds of an M‑Files version change and reloads the assemblies automatically. See MFSQL <database> - Set Assembly Update Flag for full details.
Daily Agent job fallback. Job MFSQL Validate `<database>` M-Files Version — runs once a day; catches the rare case where a WMI alert firing is missed. See MFSQL Validate <database> M-Files Version for full details.
Manual reload. Run spMFUpdateAssemblies directly at any time to force a reload.
SQL Server Express. WMI alerts and the Agent-job fallback both require SQL Server Agent, which Express does not have. On Express installations, both layers skip cleanly during deployment — reload assemblies manually after every M‑Files upgrade:
EXEC dbo.spMFUpdateAssemblies;
Prerequisites and security¶
The Connector relies on SQL CLR to host the M‑Files .NET/COM interop. On the SQL Server that hosts the Connector database, ensure:
CLR is enabled:
-- Requires sysadmin permissions sp_configure 'show advanced options', 1; RECONFIGURE; sp_configure 'clr enabled', 1; RECONFIGURE;
Permission set: assemblies require
UNSAFEdue to COM interop with M‑Files APIs.- SQL Server 2017+ strict security: with
clr strict securityenabled by default, assemblies are treated as UNSAFE unless trusted. Prefer either of:
Sign the assembly; create a login from the certificate and grant
UNSAFE ASSEMBLY.Whitelist the assembly by hash using
sys.sp_add_trusted_assembly.
- SQL Server 2017+ strict security: with
- Avoid setting the database
TRUSTWORTHYoption ON; use signed/trusted assemblies instead.
- Avoid setting the database
See also: Using CLR.
Troubleshooting after M‑Files upgrades¶
On the Integration Connector, the WMI alert or the daily Agent job normally reload the assemblies automatically — no action is required. If assembly loading still fails after upgrading the M‑Files client on the SQL Server (for example, on SQL Server Express, where neither automatic layer is available):
Run spMFUpdateAssemblies manually (or spMFCheckAndUpdateAssemblyVersion to re-run the version check first).
- Re‑establish trust for the updated assembly if
clr strict securityis enabled (the binary hash will have changed). Re‑sign or re‑run
sp_add_trusted_assembly.
- Re‑establish trust for the updated assembly if
Confirm
'clr enabled'remains set to 1.
Deprecated settings¶
MFSettings.MFInstallPath is retained for backward compatibility with installer
scripts and maintenance procedures that pass it, but is no longer used for Interop
DLL path resolution — see Where the Interop assembly is loaded from above. No
customer action is required; existing values are left in place.