I had a frustrating afternoon the other week, when I wrote a simple plugin but the plugin was throwing an error in the first line of code.
The plugin compiled without problem.
In the end I took out all the code except for some logging statements but it was still throwing an error.
This particular project we were using log4net, which is offers a good middle ground if there are a lot of developers all interested in getting logging information and debugging their various plugins etc.
I should also mention I was using the CRM developer visual studio add in.
I went over all the areas which might cause problems and got to the RegisterFile.crmregister. This file contains the plugin details, information like what entity, when the plugin is triggered.
I then noticed the problem (I say me it was actually a fellow developer who told me to check it) but the isolation mode was defaulted to Sandbox as you can see from the line below
<Solution Assembly=”test.Plugins.dll” Id=”55b7d62d-9111-e111-8eab-1cc1dee89a7f” IsolationMode=”Sandbox” SourceType=”Database”>
The reason why my plugin was crashing was being the Log4net was using a a third party dll which was held in the GAC. Plugins which use the isolationMode of Sandbox are not allowed to call any dll’s otherwise they throw an error.
I changed the isolation mode to none and it worked. Pity it took me 2 or 3 hours to work.
Hi Hosk,
This only works if you are writing an plugin for on-premise or IVF as your plugin must run in Sandbox mode for CRM online.
Nevertheless, I have been reading your blog for a couple of months now and I have been really enjoying it. Keep on going!
So long,
Wos
LikeLike
Hi Ben,
Suppose I need to reference external DLL’s and I have CRM 2013 Online.
What would you recommend as the best options?
Cheers,
Stanley
LikeLike
Hello
If you need to access dll’s then you can merge a few DLLs into one DLL, which is a bit like zipping them all up into one.
They is a free tool to do this but I can’t remember it’s name but if you Google it you should find it and some CRM articles I should think
LikeLike
ILMerge
http://blogs.msdn.com/b/crm/archive/2010/11/09/how-to-reference-assemblies-from-plug-ins.aspx
LikeLike