In plug-in development of Microsoft Dynamics CRM 4.0, third-party DLL is often referenced. If it is deployed on a disk, it will not have a great impact. If it is deployed on a database, the plug-in cannot run because it references a third-party DLL. In my opinion, the plug-in deployment tool only serializes the plug-in DLL to the database, but the third-party DLL is not in it. Is it impossible to deploy plug-ins that reference third-party class libraries in the form of databases?
To solve this problem, I have found two methods:CodeMigrate to the plug-in DLL. Second, use ilmerge to mix multiple DLL files. The first method is obviously unrealistic in some cases, so I will tell you the second method.
First, download the ilmerge tool from Microsoft:
This is: http://www.microsoft.com/downloads/en/details.aspx? Familyid = 22914587-b4ad-4eae-87cf-b14ae6a939b0 & displaylang = en
Use this tool to package plugin into a DLL.
I use one of my test plug-ins as an example:
This plug-in references a third-party class library of LINQ to CRM for query convenience. It has two DLL files: linqtocrm. DLL, the second is stunnware. CRM. fetch. DLL, coupled with my own plug-in DLL, a total of three DLL need to be merged. Note that the Microsoft. CRM. SDK and Microsoft. CRM. sdktypeproxy dll must not be merged.
Next we can use the command prompt to merge the DLL. First we need to go to the installation directory of ilmerge, and then enter the following command:
Note:/Keyfile: this parameter is mandatory for the newly merged DLL. If no plug-in is available, an error is returned.
Here, the three DLL files will be merged into one named mytest. dll, which can be deployed in the database mode, and there is no problem with the disk.