How to Resolve "Not a Valid Add-in" Occurrence


 Problem:

 

A build of add-in was run and compiled successfully in a .NET Framework in MS Visual Studio. However, the released add-in cannot be run with DraftSight. Adding the add-in to DraftSight using File ->Open (*.DLL) generates “.dll is not a valid add-in" message in the DraftSight Command prompt.

 

Solution:

 

 Using MS Assembly Registration Tool (Regasm.exe) to add the necessary entries to the registry, which allows COM clients to create .NET Framework classes transparently - explained in http://msdn.microsoft.com/en-us/library/tzat5yw6(v=vs.80).aspx

 

 

Procedure:

 

1) Open Windows Command window, if your login credentials requires Administrator do so be right-clicking on the on the Command Prompt in the Start -> All program and select Run as Administrator.

2) In the Command window, run the ‘REGASM   /tlb   /codebase’   command on the Released add-in.dll.

 

For example, here is  copy of the Command dialog of the regasm /tlb /codebase applied on:

 

" C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319>regasm /codebase "C:\\myDraftSightAddin.dll"

 

Microsoft (R) .NET Framework Assembly Registration Utility 4.0.30319.1 Copyright (C) Microsoft Corporation 1998-2004.  All rights reserved.

RegAsm : warning RA0000 : Registering an unsigned assembly with /codebase can cause your assembly to interfere with other applications that may be installed on the same computer. The /codebase switch is intended to be used only with signed assemblies. Please give your assembly a strong name and re-register it.

Types registered successfully."

 

 

3) In DraftSight open the Release complied add-in.dll using File-> Open (*.DLL) .

 

4) DraftSight opens an Addin Activation window for the new complied add-in. Fill the windows required information and click OK. The Addin menu or button will appear on the DraftSight Main toolbar. That add-in will be included  in the Tools -> DraftSight Add-ins window.