Fix assembly reference error in plugins when reported upon import

Problem

Plugins failing upon import with the error "Some references failed to resolve..." is a fairly common error, but thankfully it is often, not always, but often, simple to fix.

Solution

Steps to fix:

  1. Import plugin

  2. Get  "Some references failed to resolve..." error - click OK

  3. Get "C:\xxx\yyy.xml Imported." message - click OK

  4. Go to the "Assembly References" tab

  5. Turn on custom columns by right-clicking on a column header and ticking "Use Custom Columns", right-click on a column header and choose "Manage Grid", and in the "Manage Columns" dialog move the "Bin" column to the top by clicking and dragging on it's row header. Click OK to close the "Manage Columns" dialog. This step will make things easier later on.

  6. Sort the "Assembly References" grid by the "Full Name" column

  7. Scroll down until you find a row or rows with a "Full Name" of "Could not load file or assembly XXX"

  8. Delete such rows

  9. Back on the "Code" tab, click the "Compile" button. You should get no error at this point - if you do it must be passed onto Programming to fix.

  10. Save.



What is happening:

When a plugin is created it gets a template set of references - common ones which are most likely to be used by the plugin author. This saves the plugin author time - they don't have to go and add basic references, they can just jump straight into coding.

Further, the plugin author can add additional references as required, such as JiwaInventory.dll. It all depends on what functions the plugin author is wanting to call and in which dll those functions reside.

Now, sometimes, between versions of Jiwa we may remove a dll from the installation. Perhaps it is no longer required. Perhaps it has been replaced with one by a different name. Sometimes we get new versions of third-party dlls and their "fingerprint" is changed. We do our best to deal with all this when a database is upgraded but inevitably some changes require human intervention.

So if a plugin is imported, and it is looking for a dll that has been removed, renamed, or had it's "fingerprint" changed, you will get the "Some references failed to resolve..." error, indicating a "broken" reference. But more often than not the broken reference is not actually even used by the plugin code - so the broken reference can be safely deleted. Remember we provide a template set of basic references as a courtesy, they are not necessarily used by the plugin code.

When you compile the plugin code at step 9 above, compilation will fail if the code was actually using the broken reference, in which case more specialised programming knowledge is required to fix hence why you should then hand it off the the Programming Department.