With older versions of Dynamics NAV, Business Central or Document Creator some users would run into the following message in the Windows client:
A call to DocumentCreator.<MethodName> failed with this message: Could not load file or assembly '<assembly>' or one of its dependencies. The system cannot find the file specified.
This is a known issue with how Microsoft Dynamics NAV deploys control add-ins. When a client add-in is used for the first time, its DLLs and other resource files are moved to a temporary directory (i.e., %temp%). When the files from the temporary directory are removed (e.g., by Windows Update, a virusscanner, or a clean-up tool), then the next time you try to use the add-in it will automatically download the resources again. However, if only some of the resources of a control add-in are removed, but the main assembly is still there, then Microsoft Dynamics NAV will not update the add-in cache, after which you may run into the above error.
In the latest versions of Document Creator we have addressed this flaw in the Microsoft Dynamics NAV add-in caching mechanism. Document Creator prevents the assemblies and other resources from being removed while the Microsoft Dynamics NAV Windows client is running, and if files are missing they will be automatically restored.
If you run into this issue and are using an old version of Document Creator, then please update your installation to the latest available version.
Clearing the Add-In Cache Manually
To clear the client add-in cache for the Microsoft Dynamics NAV Windows Client:
- Close all the Microsoft Dynamics NAV Windows Client and C/SIDE sessions.
- On the client computer, open Windows Run (⊞ + R) and open: %temp%
- Open the "Microsoft Dynamics NAV/Add-Ins" subfolder.
- Start the Microsoft Dynamics NAV Windows Client again.
To clear the server add-in cache on the Microsoft Dynamics 365 Business Central or Microsoft Dynamics NAV server:
- Stop the concerned Server Instance(s).
- If the service uses a NetworkService account, then clear the cache from the following directory:
C:\Windows\ServiceProfiles\NetworkService\AppData\Local\Temp\Microsoft Dynamics NAV\Add-ins\<version>\<assembly_name>
If the service uses a dedicated user account, then clear the cache from the following directory:
C:\Users\AccountName\AppData\Local\Temp\Microsoft Dynamics NAV\Add-Ins\<version>\<assembly_name>
- Start the Server Instance(s) again.
Other Reasons for this Error
It could also be that you simply did not install the (latest version of the) Document Creator control add-in yet. You should see a question on start-up (NAV), a notification in the role center or a notification on the Custom Report Layouts page that will show up if you did not install the required version of the control add-in yet. Alternatively, you can install the control add-in using the Install Add-In action in the Document Creator Setup page (or setup wizard).
Cannot create an instance of the following .NET Framework object