Deploy Inventor Add-In to MSI package

Deploy Inventor Add-In to MSI package

Maxim-CADman77
Advisor Advisor
1,349 Views
19 Replies
Message 1 of 20

Deploy Inventor Add-In to MSI package

Maxim-CADman77
Advisor
Advisor

I've finished development of my first original Add-In for inventor and would like to know how could I deploy it to MSI package for other users?

 

I do see description on how to deploy Inventor Add-In as 7zip-SFX or EXE (see forum thread Inventor Add in Publish to MSI or exe) but I personally prefer MSI (the filetype used for sharing applications in Autodesk App Store).

 

I use MS Visual Studio Community 2019 (with "Microsoft Visual Studio Installer Projects" extension installed), and try to follow recommendations of the article Set up your desktop application for MSIX packaging in Visual Studio.

 

When I try to add a reference to my Add-In (Application type = "Class Library") project to dependencies of the Packaging Project I get error "To add an application reference, the project output needs to be an executable."

 

What I'm missing?


Thanks in advance.

Please vote for Inventor-Idea Text Search within Option Names

0 Likes
Accepted solutions (1)
1,350 Views
19 Replies
Replies (19)
Message 2 of 20

Michael.Navara
Advisor
Advisor

I prefer and use WiX Toolset for creating MSI packages for several years. It is very strong tool, but perhaps "too big hammer" for beginners. 

Main advantages for me are full integration to VS (setup project in one solution of add-in) and strong tools for auto-generating XML descriptions based on folder content for large applications.

 

Also you can try another tool. For example https://sourceforge.net/projects/nsis/

 

Message 3 of 20

Maxim-CADman77
Advisor
Advisor

@Michael.Navara 

 

After couple hours of reading NSIS documentation I realized that it is not something I would succeeded with after just 15 minutes (what nobody promised although I've read it so).
The most frustrating thing about NSIS - I failed to find any Autodesk Inventor Add-In Installer related NSI sample (which is a bit strange). 


Thus I'd rather opt for "Wix Toolset" (even if it is of same complexity I'd get VS integrated workflow).

Don't you know whether "Wix Toolset Visual Studio 2019 Extension" would be enough or should I also install "Wix Toolset Build Tools"?

Wix-VS-Extensions.png

Please vote for Inventor-Idea Text Search within Option Names

0 Likes
Message 4 of 20

Michael.Navara
Advisor
Advisor
Accepted solution

You need to install WiX Toolset build tools and also VS Extension as you mention above.

 

In attachment is minimalistic project of AddIn with WiX MSI setup. It is created in VS 2022, but I hope it will work in 2019 too.

You need to modify resources in Binaries folder (EULA.rtf, AddIn.ico, banner.jpg and dialog.jpg) and Manufacturer value in Product.wxs file.

You can also create a VS Project template from this sample, but this is another question.

 

I hope it helps.

 

Message 5 of 20

Maxim-CADman77
Advisor
Advisor

@Michael.Navara 

Sorry for endless questions but ... do I get it right that to work with MSIs I also need to install Windows SDK ?

Please vote for Inventor-Idea Text Search within Option Names

0 Likes
Message 6 of 20

Michael.Navara
Advisor
Advisor

I don't install nothing special. But I don't remember there are some prerequisites for WiX Toolset.

Perhaps you need to install .NET Framework 4.8 (or downgrade the add-in project)

0 Likes
Message 7 of 20

Maxim-CADman77
Advisor
Advisor

@Michael.Navara 

The sample you've shared is extremely valuable (I need some more time to understand all tricks included).


Correct me if I mistaken - it doesn't pre-check presence of the Inventor installed, right?
My Add-In (I believe) is multi-version compatible (2021 and newer).

 

Don't you know the way to limit MSI application accordingly (auto-cancel Add-In install if none of the compatible Inventors is installed)?

 

Should I use RegistrySearch Element (try read value of "LastVersionRun" at HKLM\SOFTWARE\Autodesk\Inventor\Current Version)?

Please vote for Inventor-Idea Text Search within Option Names

0 Likes
Message 8 of 20

Michael.Navara
Advisor
Advisor

I don't use this check for compatible Inventor version. Perhaps it is possible, but I don't know if it is necessary.

When you specify correct minimal version in .addin file, you are OK.

Usually I describe the the minimal Inventor version in system requirements of my add-in. 

0 Likes
Message 9 of 20

mslosar
Advisor
Advisor

Considering that most of my addins are 1 or 2 dll files and the .addin file, i just went with making a bat file to place the files where they need to go.

0 Likes
Message 10 of 20

Maxim-CADman77
Advisor
Advisor

@Michael.Navara 

Could you, please, explain how you've put C#-entry under References of SetupSample_Setup project?

CS-in-Wix.png

Please vote for Inventor-Idea Text Search within Option Names

0 Likes
Message 11 of 20

Michael.Navara
Advisor
Advisor
0 Likes
Message 12 of 20

Maxim-CADman77
Advisor
Advisor

Thank you.

I wonder is it ok not to get correct (C#) entry icon (like on your screenshot)?

 

PS:

I'm asking this because I fail to reference files of my Add-In project in my Setup project via project name variable. I'm using VB and payed attention the two icons differ:

Untitled.png

thus decided I'm missing something.

 

PPS:

I use Wix 3.11 and try to follow a bit outdated 3.6 Wix Developer's Guide
which contains unclear statement (page #47 (70 in pdf)):


"You can also refer to other projects in your Visual Studio solution using preprocessor
variables. For example, let's say you had a class library project in the same solution
as your WiX setup. If you were to add that class library as a reference in the WiX
project, you could then refer to its output directory using $(var.ProjectName.
TargetDir), as in the following example:.."

Please vote for Inventor-Idea Text Search within Option Names

0 Likes
Message 13 of 20

Maxim-CADman77
Advisor
Advisor

Yes - I was doing wrong (and generic icon was the marker of it).
The fault was adding DLL instead of the Project (using wrong Tab in Add Reference dialog).

Now icon is correct:

Untitled.png

and preprocessor variable works as expected.

Sorry for stupidity.

Please vote for Inventor-Idea Text Search within Option Names

0 Likes
Message 14 of 20

Michael.Navara
Advisor
Advisor

This is not stupidity. 😉

I spent a few days building my first MSI package

Message 15 of 20

Maxim-CADman77
Advisor
Advisor

@Michael.Navara 

 

Sorry to inform but I'm still struggling with my 1st MSI


Could you, please, share the screenshot showing content of properties panel for the setup project of the solution you've provided (select the setup project and press F4)?

I'm asking for this because I do suffer several unexpected issues* and I believe the problem might be in my VS config.


Property set that my VS shows I believe looks incomplete:

SetupSample_Setup-Project-Props.jpg
If I'm not mistaken the ARPPRODUCTICON property should be there, right?

*
One of issues mentioned - when I try to customize icon for my add-in's entry in Program and Features I does change but just to some another standard/generic icon 😞

Please vote for Inventor-Idea Text Search within Option Names

0 Likes
Message 16 of 20

Maxim-CADman77
Advisor
Advisor

Dear @Michael.Navara ,

I've got your private message but can't answer you by PM* thus answering here.

 

My VS-solution (simplified to just reproduce the issue mentioned** on ‎2022-11-25 10:09 AM) is available here: https://github.com/CadMan77/CJSC_VB.git


*

When I press "send" forum blocks me mith message telling that I've already used limit* for sending private messages). Just FYI, I've send 24 PMs within last 10 years (3 PMs within 2022).
**

Are you sure the problem from the code itself (and not from my VS config)?

Please vote for Inventor-Idea Text Search within Option Names

0 Likes
Message 17 of 20

Maxim-CADman77
Advisor
Advisor

Update:
I've tried to apply icon from your project to mine ... and got the desired. 
I'll give some deeper icon testing and report the result of it here.

Please vote for Inventor-Idea Text Search within Option Names

0 Likes
Message 18 of 20

Maxim-CADman77
Advisor
Advisor

My problem with icon reason was: For some reason I used WixVariable instead of Property  (ARPPRODUCTICON).

Now my 1st MSI is almost ready.

There are just couple niceties I'd like to introduce:

1. Make sure Inventor.exe process is not running just before InstallInitialize.

2. Provide user an option to launch Inventor (after InstallFinalize).

Please vote for Inventor-Idea Text Search within Option Names

0 Likes
Message 19 of 20

Maxim-CADman77
Advisor
Advisor

@Michael.Navara 
Could you, please, clarify purpose of this code block in Products.WXS:

 

 

 

    <!--Uninstall older vesions-->
    <Upgrade Id="$(var.UpgradeCode)">
      <UpgradeVersion Minimum="$(var.Version)" IncludeMinimum="no" OnlyDetect="yes" Property="NEWERVERSIONDETECTED" />
      <UpgradeVersion Minimum="0.0.0" Maximum="$(var.Version)" IncludeMinimum="yes" IncludeMaximum="no" Property="OLDERVERSIONBEINGUPGRADED" />
    </Upgrade>

    <InstallExecuteSequence>
      <RemoveExistingProducts After="InstallInitialize" />
      <Custom Action="NewerVersion" After="FindRelatedProducts">NEWERVERSIONDETECTED</Custom>
    </InstallExecuteSequence>

    <CustomAction Id="NewerVersion" Error="A later version of [ProductName] is already installed." />

 

 

 

 

I thought It should provide correct updating of the Add-In but If I run build setup project, Install the Sample Add-In with output MSI then rebuild setup project and run the updated MSI I'll get doubled Sample Add-In in Control Panel:

Doubled Sample AI Add-In.jpg

What I'm missing?

 

UPDATE:
I've found couple valuable comments regarding auto-generated software 4-number versioning (Major, Minor, Build, Revision):
#1: The 3rd number is the number of days since the year 2000, and the 4th number is the number of seconds since midnight (divided by 2).

#2: Windows Installer ignores the fourth digit when detecting other versions of your software, so you should only rely on the first three.
... still not sure if doubling software entry is "as expected" but at least installing setup with larger 3rd number does the trick (removes/uninstalls both previous versions)
Of course I don't plan to roll-out several updates per day, yet I don't understand how to compile (test) several revisions per day.

Please vote for Inventor-Idea Text Search within Option Names

0 Likes
Message 20 of 20

Michael.Navara
Advisor
Advisor

For testing purposes you can modify this part of WXS file to fixed version instead of binding version to DLL version. Modify line 2 as mentioned on line 1.

 

	<!--Version - Can be replaced with fixed string i.e. 1.0.0.0-->
	<?define Version = "!(bind.fileVersion.$(var.MainAddinFile).dll)" ?>
	<Product
	  Id="*"
	  UpgradeCode="$(var.UpgradeCode)"

	  Name="$(var.ProductName)"
	  Version="$(var.Version)"
	  Manufacturer="Arkance Systems"
	  Language="1029"
	  Codepage="1250"
       >

 

 

0 Likes