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, the embedded assemblies become out‑of‑sync and the Connector will fail to load the API.

Automatic monitoring and updates

Since 4.3.9.48 the Connector can monitor the installed M‑Files version and update the assemblies automatically:

  • An Agent job is created during installation to run daily. It checks the installed

    version using spMFCheckAndUpdateAssemblyVersion. If the version changed, it updates MFSettings and executes spMFUpdateAssemblies.

  • You can run spMFUpdateAssemblies manually at any time to refresh the assemblies.

Important: The Connector will fail if the M‑Files API version changes without refreshing the assemblies in the database.

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 UNSAFE due to COM interop with M‑Files APIs.

  • SQL Server 2017+ strict security: with clr strict security enabled 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.

  • Avoid setting the database TRUSTWORTHY option ON; use signed/trusted assemblies

    instead.

See also: Using CLR.

Troubleshooting after M‑Files upgrades

If assembly loading fails after upgrading the M‑Files client on the SQL Server:

  • Run spMFCheckAndUpdateAssemblyVersion or spMFUpdateAssemblies.

  • Re‑establish trust for the updated assembly if clr strict security is enabled

    (the binary hash will have changed). Re‑sign or re‑run sp_add_trusted_assembly.

  • Confirm 'clr enabled' remains set to 1.

Reference: spMFUpdateAssemblies

Type

Description

Procedure

spMFUpdateAssemblies

Inputs

Debug: 1 = Debug Mode; 0 = No Debug (default)

Returns

1 = success