Tuesday, August 26, 2008

Plugins and Add-ons With Multiple Server CRM Deployment

Recently I had a remarkable amount of trouble with the SDK on a particular CRM deployment. After a spot of poking around I managed to find that this deployment actually consists of 3 servers.
Application Server
Platform Server
Database Server

This configuration seemed to be working fine for some time with plugins hosted on the Application Server, but when I came to write applications using the web services hosted on the Platform Server I received the following error: 0x80044191 Assembly can not be loaded from C:\Program Files\Microsoft Dynamics CRM\server\bin\assembly\MyOrganisation.Plugins.dll. Platform.

Here's the fix:
If plugins are registered, ensure they are deployed with source on database.

If the plugin source MUST be on disk, then it must be stored on the Platform Server. Not the Application Server

Sunday, August 10, 2008

Winforms: Close your form during Load event:

On occasion you may find that you need to open a form and have that form then decide if it needs to remain open.

Closing a form through click of a button is normally not an issue. Its as simple as:

Me.Visible = False
or
Me
.Close

The second method will clear and remove the form from memory. But this means that the form would already have to be visible. Doing this during Form Load will cause an ObjectDisposedException.

But you want your form to close BEFORE it even becomes visible to the user? There are 2 ways to do this.

If your form is a dialog:
VB: Me.DialogResult = DialogResult.Cancel
C#: this.DialogResult = DialogResult.Cancel;

Otherwise, place this code in the form load event:
VB: Me.BeginInvoke(New MethodInvoker(AddressOf Me.Close))
C#: this.BeginInvoke(new MethodInvoker(this.Close));