Custom Inventor Add-In from 2018 no longer loads in 2020

Custom Inventor Add-In from 2018 no longer loads in 2020

Anonymous
Not applicable
657 Views
4 Replies
Message 1 of 5

Custom Inventor Add-In from 2018 no longer loads in 2020

Anonymous
Not applicable

Since upgraded to Inventor 2020, only one of my custom tools has failed to load. When I go to manually change it to load, it switched back to unloaded when I open the add-ins menu to check it.

 

Here is my .addin file, which is located at C:\ProgramData\Autodesk\Inventor Addins

I place SampleTool.dll directly into C:\Program Files\Autodesk\Inventor 2020\Bin

<Addin Type="Standard">
  <!--Created for Autodesk Inventor Version 22.0-->
  <ClassId>{bc210232-db1f-4e35-9c46-6f8ec8d2752a}</ClassId>
  <ClientId>{bc210232-db1f-4e35-9c46-6f8ec8d2752a}</ClientId>
  <DisplayName>SampleTool</DisplayName>
  <Description>SampleTool</Description>
  <Assembly>SampleTool.dll</Assembly>
  <LoadOnStartUp>1</LoadOnStartUp>
  <UserUnloadable>1</UserUnloadable>
  <Hidden>0</Hidden>
  <SupportedSoftwareVersionGreaterThan>21..</SupportedSoftwareVersionGreaterThan>
  <DataVersion>1</DataVersion>
  <UserInterfaceVersion>1</UserInterfaceVersion>
</Addin>

 

Here is my .manifest file before I complied the tool.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">

  <assemblyIdentity name="SampleTool" version="1.0.0.0"></assemblyIdentity>

  <clrClass clsid="{bc210232-db1f-4e35-9c46-6f8ec8d2752a}" progid="SampleTool.StandardAddInServer" threadingModel="Both" name="SampleTool.SampleTool.StandardAddInServer" runtimeVersion=""></clrClass>

  <file name="SampleTool.dll" hashalg="SHA1"></file>

</assembly>

I have not been able to get this add in to load, on any of the computers in our office. Does anyone have any idea of why this would happen?

0 Likes
658 Views
4 Replies
Replies (4)
Message 2 of 5

JelteDeJong
Mentor
Mentor

dllRefrenceProperties.pngYou could check dll refrence properties of "Autodesk.Inventor.Interop.dll".

 

Do you have a try/catch block in you function "StandardAddInServer.Activate()". Something like:

public void Activate(ApplicationAddInSite addInSiteObject, bool firstTime)
{
    try
    {
        // your code here
    }
    catch (Exception ex)
    {
        Console.WriteLine(ex.Message);
// or some other way to show what went wrong
// something like a MessageBox is also greate } }

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com

0 Likes
Message 3 of 5

Anonymous
Not applicable

@JelteDeJong wrote:

You could check dll refrence properties of "Autodesk.Inventor.Interop.dll".


My values for Specific Version and Version match yours, although Copy Local is set to True. Could that cause any specific issues?

 


@JelteDeJong wrote:

Do you have a try/catch block in you function "StandardAddInServer.Activate()"


No, this is all I have for that function:

Public Sub Activate(ByVal addInSiteObject As Inventor.ApplicationAddInSite, ByVal firstTime As Boolean) Implements Inventor.ApplicationAddInServer.Activate
            ' Initialize AddIn members.
            g_inventorApplication = addInSiteObject.Application

            ' Connect to the user-interface events to handle a ribbon reset.
            m_uiEvents = g_inventorApplication.UserInterfaceManager.UserInterfaceEvents


            ' Add to the user interface, if it's the first time.
            If firstTime Then
                AddToUserInterface()
            End If

            InventorApplicationEvents = g_inventorApplication.ApplicationEvents
0 Likes
Message 4 of 5

JelteDeJong
Mentor
Mentor

Im not sure about the best settings for dll refrences. (i just had problems once with wrong dll versions that is why i know its importend.)

The try catch block in VB would look like this.

Public Sub Activate(ByVal addInSiteObject As Inventor.ApplicationAddInSite, ByVal firstTime As Boolean) Implements Inventor.ApplicationAddInServer.Activate
	Try
            ' Initialize AddIn members.
            g_inventorApplication = addInSiteObject.Application

            ' Connect to the user-interface events to handle a ribbon reset.
            m_uiEvents = g_inventorApplication.UserInterfaceManager.UserInterfaceEvents


            ' Add to the user interface, if it's the first time.
            If firstTime Then
                AddToUserInterface()
            End If

            InventorApplicationEvents = g_inventorApplication.ApplicationEvents
        Catch ex As Exception
            g_inventorApplication.StatusBarText = ex.Message
        End Try
end sub

(in my privous post i expected you would work with c#. )  if this work and a exception is catched then you should see a message in you status bar. (usually you cant use a msgbox in a dll therfor the strange construction with the statusbar)

 

An other thought can u put a break point at the start of you Activate function does it stop there?

 

Just another tought

 

 

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com

0 Likes
Message 5 of 5

Anonymous
Not applicable

It's okay, most people here use anything but .NET but this add-in was made a while ago so I just manage with what I have.

 

I threw that Try-Catch into the sub, the message I managed to capture was: "The type initializer for 'SprayTechTools.Globals' threw an exception."

 

When I debugged, it got to g_inventorApplication = addInSiteObject.Application and then threw the error.

0 Likes