spMFUpdateAssemblies¶
- Returns
1 = Success
-1 = Error
- Parameters
- @MFilesVersion nvarchar(100) (optional)
Retained for backward compatibility and logging only.
No longer determines the Interop DLL file path.
If NULL, MFSettings.MFVersion is read for logging purposes.
If provided, MFSettings.MFVersion is updated to this value (informational).
- @Debug int (optional)
Default = 0
1 = Standard Debug Mode
101 = Advanced Debug Mode
Purpose¶
Drop, reload, and recreate all CLR assemblies and procedures.
Additional Info¶
This procedure is compiled during installation and can only be used in the target database.
As of 2026-04-22: Interop.MFilesAPI.dll is resolved dynamically at runtime (Change 8):
If M-Files client is detected in the registry (
HKLM\SOFTWARE\Motive\M-Files), the procedure locates Interop.MFilesAPI.dll from the client install path -Bin\X64\for M-Files 26.1+,Common\for earlier versions. This prevents GAC signature mismatches that occur when a bundled DLL differs from the version registered in the Windows GAC by the M-Files client installer.If M-Files client is not installed: falls back to AssemblyInstallPath (the MFSQL assemblies folder). Interop.MFilesAPI.dll must be pre-copied there by the MFSQL installer.
MFInstallPath is no longer used for Interop DLL path resolution.
WMI Event Alert (Integration Connector). An automated WMI alert deployed by
35.703.job.CreateMFilesUpdateAlert.sql (shipped in the Integration Connector
bundle) detects M-Files version changes within seconds and calls this procedure to
reload assemblies. The script runs automatically during install and upgrade and can be
re-run manually in SSMS against the MFSQL application database. On servers with
multiple MFSQL application databases, run the script once per database.
On SQL Server Express installations - where no SQL Server Agent is available - the WMI alert is not created. Call this procedure manually after every M-Files upgrade.
Use @MFilesVersion to record a specific M-Files version in MFSettings (useful to correct an erroneous version or for logging purposes).
Examples¶
To update the assemblies based on the MFVersion in MFSettings
EXEC dbo.spMFUpdateAssemblies;
To update the assemblies with a different MFVersion or manually update the assemblies
EXEC dbo.spMFUpdateAssemblies @MFilesVersion = '19.8.8082.5';
Roadmap¶
Items tracked in Issue #41 and sub-issues to be created:
Deprecate MFInstallPath in MFSettings - MFInstallPath is no longer read by this procedure; remove from MFSettings after confirming no other callers depend on it.
Deprecate MFVersion from MFSettings - phased removal after all callers are updated to not rely on it for path construction.
Identify minimum DLL set - the PoC copied the entire M-Files bin folder; determine and document the exact minimum set required in AssemblyInstallPath.
Full M-Files client elimination - once the minimum DLL set is confirmed and packaged, the M-Files client can be removed entirely from the SQL Server.
CLR-to-API migration - longer-term: eliminate the CLR dependency entirely by migrating to direct M-Files REST/gRPC API calls.
Changelog¶
Date |
Author |
Description |
2026-04-22 |
AC |
Dynamic registry detection for Interop.MFilesAPI.dll path (Change 8) |
2026-03-25 |
AC |
Load Interop.MFilesAPI from AssemblyInstallPath; remove MFInstallPath dependency |
2021-10-07 |
LC |
add spMFGetFilesInternal, spMFGetHistory |
2021-04-01 |
LC |
Get master db owner and set DB to default owner |
2020-11-10 |
LC |
test that all the clr procedures have been dropped |
2020-11-10 |
LC |
prevent assemblies to be deleted |
2020-10-27 |
LC |
Refine error messages and logging |
2019-09-27 |
LC |
Add MFilesVersion parameter with default |
2019-01-11 |
LC |
IF version in mfsettings is different from installer then use installer add parameter to set MFVersion |
2019-01-09 |
LC |
Add additional controls to validate MFversion, exist when not exist. |
2018-09-27 |
LC |
Add control to check and update M-Files version. This is to allow for the CLR script to be able to be executed without running the app. |
2017-07-25 |
LC |
ADD SETTING TO SET OWNER TO SA |
2017-05-04 |
DevTeam2 |
Added new parameter DeleteWithDestroy |
2016-09-26 |
DevTeam2 |
Removed vault settings parameters and pass them as comma separated string in VaultSettings parameter. |
2016-03-10 |
LC |
Created |