Inventor 2012 allows your Add-Ins to be loaded without them being registered as a COM component in the Windows registry. These Add-Ins are called “registry free Add-Ins”. I was sure happy when I could have my Add-In load without having to use the Windows registry. It really makes installing custom applications much easier.
The Inventor 2012 Add-In wizard provided with the SDK uses a new template that generates a Registry Free Add-In. If you want to migrate your existing Add-Ins without re-creating them from scratch (using the new template) you can follow these five steps.
For Visual Express Edition, the setting is slightly different, un-check the “Make assembly COM-Visible”:
Remove any code associated with registering the add-in in the registry. This typically just means removing the Register and Unregister methods from your add-in class. The AddInGuid property is in the same region as the registration functions, so if you intend on using this property in other areas of your add-in you’ll want to be careful not to delete it.
2. Create the manifest file
Create a new file in the same directory as your project file and name it “YourAddin.X.manifest”, where YourAddin will be replaced with the name of your add-in. Add the following to the manifest file. The portions highlighted in yellow need to be edited to match your add-in properties:
The “name” attribute of the clrClass element consists of three parts, separated by dots:
To make sure, you can retrieve the assembly name and root namespace from your project properties:
Note: The manifest file is not Unicode!
3. Embed the manifest during post-build
The next step is to add a post-build process to incorporate this manifest into your dll. The post-build process calls mt.exe which is a Microsoft utility that will embed the manifest into your AddIn’s dll. You define a post-build step through the Compile tab of the Application Properties dialog. On the Compile tab, click the “Build Events…” button and then on the “Build Events” dialog click the “Edit Post-build…” button. Finally enter the following string by replacing the correct Add-In name into the “Post-build Event Command Line” dialog, as shown below:
call "%VS90COMNTOOLS%vsvars32" mt.exe -manifest "$(ProjectDir)RegFreeVbAddin.X.manifest" -outputresource:"$(TargetPath)";#2
Compile your project. This will cause the manifest to be embedded within your dll. If you get any errors when compiling, verify that the command line that you entered matches the one above.
You can verify that the manifest has been correctly embedded by dragging the Add-In dll into Visual Studio. You should see the “RT_MANIFEST” folder, as shown below. Double clicking on the “2” icon will open a window to show you actual manifest data.
It appears that the “build events” functionality is not provided for Visual Basic Express. It is there for C# Express and of course regular versions of Visual Studio. If you use VB Express you can manually invoke the mt utility from the command line or create a batch file.
4. Create the .addin file
A requirement for all registry-free Add-Ins is to have an .addin file. With a registry based Add-In, Inventor relied completely on the registry to get information about the Add-In. The .addin file takes the place of the registry for this same information.
The addin filename is in the form of Company.AddInName.Inventor.addin
Below is the .addin file for my example Add-In with the portions to change highlighted:
<!--Created for Autodesk Inventor Version 16.0-->
<!--Override settings for ApplicationAddIn: RegFreeVbAddin-->
A Registry-free Inventor Addin
For most AddIns, the ClassId (required) and ClientId (required) elements will be the same value, which is the GUID at the top of the StandardAddInServer class.
The value of the DisplayName (required) element can be anything and is the name of the add-ins as shown in the AddIn Manager.
The Description (required) element can also be anything and is the description of the add-in as shown in the AddIn Manager.
The Assembly (required) element defines the name of the AddIn dll. It also defines the path to the dll.
There are 3 ways to specify the location of the binaries:
The LoadOnStartUp (optional - obsolete) element specifies whether the add-in should load on start up. Assumed to be true if this value is not specified. Value can be 0 or 1.
The UserUnloadable (optional) element specifies whether the user can unload the add-in. Assumed to be true if this value is not specified (i.e. user can unload the add-in). Value can be 0 or 1.
The Hidden (optional) element defines whether the add-in is visible in the Add-In Manager or not. A value of 1 indicates that it is hidden, although the end-user can still right-click within the Add-In Manager and choose “Show hidden members” to display all add-ins.
The SupportedSoftwareVersionXXX (optional) element specifies the version(s) of Inventor that the add-in should be available in. Combinations of these can be used. These values are ignored if the .addin file is located in a version-specific folder (i.e. the add-in is always available for that Inventor version).
The DataVersion (optional) element specifies the version of add-in data contained within Inventor documents. To be used by add-ins that store migrating data in Inventor documents, indicated by “DocumentInterests”.
The UserInterfaceVersion (optional) element specifies the version of the user interface of the add-in. Incrementing this version results in all of the addin’s UI getting cleaned up during Inventor start-up.
The LoadBehavior (optional) element allows you to control a brand new feature of Inventor 2012: this will determine for which document type the addin will be loaded. Basically this feature will improve the start-up time of Inventor by delaying the loading of the addin the first time a specific document type is created or open, for example if your addin is only providing part-specific functionalities, you can choose to let Inventor load it only when the user will open his first part in the session.
Here is a table that recaps the various values this flag can take and its effect:
Load on Start-up (not recommended)
Load when any document is open/created
Load when first Assembly is open/created
Load when first Presentation is open/created
Load when first Drawing is open/created
Assumed to be 0 if this value is not specified.
In the case you are building an installer to deploy your Add-In, you may wonder how you would handle the situation where you let the user select the location where they will install the Add-In dll itself, as the .addin file needs to reflect this path, and the answer is that you have 2 choices here:
5. Choose a location for .addin file
Copy the .addin file to one of the following directories, depending on the scope of your add-in and the operating system.
The presence of a .addin file in the following locations indicates that the AddIn should be loaded in multiple versions of Inventor based on the values of the “SupportedSoftwareVersionXXX” settings in the manifest file.
C:\Documents and Settings\All Users\Application Data\Autodesk\Inventor Addins\
The presence of a manifest file in the following locations indicates that the AddIn should be loaded in a specific version of Inventor. The values of the “SupportedSoftwareVersionXXX” settings in the manifest file are ignored, if present.
C:\Documents and Settings\All Users\Application Data\Autodesk\Inventor 2012\Addins\
Per User Override:
The manifest file in the following locations can be created when per user overrides need to be saved. The settings in these manifest files override the setting values in the manifest files found in the ‘all users’ folder. The names of these override manifest files match the names of the “master” files.
C:\Documents and Settings\<user>\Application Data\Autodesk\Inventor 2012\Addins\
After following these steps your Add-In should be found and loaded by Inventor without any entries in the registry.