Inventor API - Add-in not updating after making changes in Visual Studio

Inventor API - Add-in not updating after making changes in Visual Studio

NateLFO
Contributor Contributor
790 Views
4 Replies
Message 1 of 5

Inventor API - Add-in not updating after making changes in Visual Studio

NateLFO
Contributor
Contributor

So, I'm just getting started with Inventor API.  I have built my first successful add-in, which creates a sketch with a circle that is defined by inputs from a form.  When I first launched it, Visual Studio kicked back an error saying that the text in  the text boxes in the form (I set the default values to 0 when designing the form), could not be converted to double, so for the time being so I could test it, I commented out the lines that Dim the values and replaced them with hard set numeric values and it worked.  I guess I'll have to convert the strings to doubles, but that's not a big deal, I know how to do that. 

 

The issue I'm having now is that when I make the changes to the VB code, save it, rebuild it, then launch the add-in through the debugger, Inventor launches and when I press the button for the add-in, it runs the old version, it did not update.  Regardless of what I put in the form, it uses the hard set values that I had before.  I did not change the name of anything, so it didn't create a new add-in, and when I went to the Inventor 2022 Addins folder, the time stamps on the files did reflect the time that I rebuilt the solution.  I tried deleting all of the files in that folder and tried again, and it replaced all of the files as I was expecting, but the add-in still ignores the form values and uses the hard set values that aren't in the project anymore at all. 

 

What do I have to do to get Inventor to get use the new version of the add-in?  The project setting for Compile still shows the build output path for the one they showed to use on the KetivAVA video, which is:

C:\ProgramData\Inventor Addins\TestAddin

This folder one shows the currently compiled .dll file, but the one in

C:\Users\xxxx\AppData\Roaming\Autodesk\ApplicationPlugins\TestAddin

This folder only shows the first successful run where I unblocked it, it hasn't been getting updated.  Am I sending these to the wrong folder, or is there a way to force Inventor to fetch the updated .dll file from the ProgramData folder?  I tried unloading, reloading, blocking, unblocking, and restarting Inventor and it is still using the old version.  I wouldn't think I would have to manually copy and replace the file in that folder each time I make a change.

 

Thank you for any information you can provide.

0 Likes
Accepted solutions (2)
791 Views
4 Replies
Replies (4)
Message 2 of 5

Michael.Navara
Advisor
Advisor
Accepted solution

When I create new Invnetor AddIn, I use following steps to setup my environment.

  1. Create new AddIn from template installed as part of SDK
  2. Open project properties and remove all content from PostBuild actions
  3. Create first build of addin to bin\Debug subfolder (default settings)
  4. Open project folder and copy *.addin file to one of the described locations (For example: C:\ProgramData\Autodesk\Inventor Addins\)
  5. Open the copied file in text editor and modify the location of compiled DLL file
    From:  <Assembly>MyAddin.dll</Assembly>
    To: <Assembly>D:\Path\To\YourAddIn\bin\Debug\MyAddin.dll</Assembly>
  6. Run Inventor and check if the addin is loaded correctly
  7. Close Inventor and...
  8. Start coding... 😀

But in this case it is not possible to compile addin, when Inventor is running. You need to close Inventor before build.

This is limitation of .NET and is very hard to solve this. It is similar to my previous post.

https://forums.autodesk.com/t5/inventor-ilogic-api-vba-forum/remove-reference-dll-i-logic/m-p/107607...

 

 
 

Message 3 of 5

NateLFO
Contributor
Contributor
Thank you! So this forces it to use the other folder where VS is building the .dll file. So, once you are done and have a final working version, do you go back and revert it to use the unspecified folder that it used before in the addin file and move the final copy to where Inventor wants to pull it from, or do you just leave it as is so it always loads it from the C:\ProgramData\Autodesk\Inventor Addins\ folder?
0 Likes
Message 4 of 5

Michael.Navara
Advisor
Advisor
Accepted solution

Usually when I have final version I create installation package.

For simple addins for few users is it possible to create just ZIP package which can be extracted to install folder. In this case you can use some Inventor addins folder (described in ReadMe.txt) or global autodesk addins folder (C:\ProgramData\Autodesk\ApplicationPlugins)

For public addins I create MSI install package with global autodesk addins folder as install folder.

In both cases I set assembly node in *.addin file to default value (<Assembly>MyAddin.dll</Assembly>)

Message 5 of 5

NateLFO
Contributor
Contributor
Thanks. That makes sense.
0 Likes