During Microsoft Dynamics CRM plugin run, we see an error message “Could not load file or assembly ‘Microsoft.Xrm.Client'”. We were using this assembly in our plugin file. After searching, we found that XRM is searching for assembly in GAC. So, we need to install ‘Microsoft.Xrm.Client.dll’ on GAC.
We tried to drag and drop, copy and paste. But, these attempts did not work on Windows Server 2008 R2 GAC. What next?
We opened MS-DOS command prompt in Administrator mode and executed COPY command like below:
COPY D:\Microsoft.Xrm.Client.dll C:\Windows\assembly\Microsoft.Xrm.Client.dll
Now, we are done. We copied successfully. But, it did not resolve the plugin issue. What was the problem?
Again, Installation and Copy are different. Simple Explanation!
After searching, we found that “gacutil.exe” tool in Microsoft SDK is helpful for assembly installation on GAC. In .Net 4.0, we can find it in below folder:
C:\Program Files\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools
Unfortunately on Windows Server 2008 R2, Visual Studio was not installed. So, we were unable to find this file on server. Next option was to download Microsoft SDK from www.microsoft.com/en-us/download/details.aspx. Very Painful!
Alternatively, we copied “gacutil.exe”, “gacutil.exe.config”, “gacutlrc.dll” from another Visual Studio Installed system and paste them on Windows Server 2008 R2. (place anywhere, we placed all three files on C:\)
"gacutil.exe", "gacutil.exe.config" from "C:\Program Files\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools"
"gacutlrc.dll" from "C:\Program Files\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools\1033"
Open MS-DOS command prompt in Administrator mode and change directory to “gacutil.exe” like below:
C:\>gacutil.exe /i D:\Projects\demo\bin\Microsoft.Xrm.Client.dll
Now, we were really done! Our assembly was on “D:\Projects\demo\bin”. You must use your own assembly file location. Our “gacutil.exe” file was on “C:\”. You must change directory to the location where you placed your “gacutil.exe” file.
To list all assembly on GAC, write below code:
To uninstall a assembly on GAC, write below code:
C:\>gacutil.exe /u Microsoft.Xrm.Client