matthewshorten
Posts: 6
Joined: Wed Jan 17, 2024 3:27 pm

"Call method from .NET assembly" CAs on 32/64 bit platform

I have an AI project that calls 11 custom actions on install, and 5 on uninstall. All of these CAs are "Call method from .NET assembly". All assemblies are compiled for "AnyCPU" so can work with whichever .NET Runtime (i.e. 32 or 64bit) is installed on the target computer.

However, I am stuck on how to set the "64-bit" checkbox against each CA in AI project.
If I leave 64-bit unticked then installing on a 64-bit Win10 with ".NET Runtime (x64)" installed then the installation fails to run the CA, saying "Failed to detect.Net Core runtime install location". Ok so, I tick the 64-bit checkbox and it installs successfully to that environment.

But it now won't install on 32-bit Win10 with ".NET Runtime (x86)" installed ... saying "Error 1723. There is a problem with this Windows Installer package. A DLL required for this install to complete could not be run. Contact your support personnel or package vendor"

As a possible workaround I'm considering duplicating the 16 CAs - making 16 with the 64-bit flag unticked and 16 with it ticked. And controlling at install/uninstall time which of the CAs are called using a condition. The condition will have to be populated based on which .Net Runtime (x86 or x64) is detected.

Before I do, can I ask is this the only solution available to me? Or is there a simpler way to support the use of "Call method from .NET assembly" CAs across 32 and 64-bit platforms?
Daniel
Posts: 8238
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: "Call method from .NET assembly" CAs on 32/64 bit platform

Hi,

I can confirm you the workaround solution you were thinking of is the correct one.

And this is just because our built-in "Call method from .Net assembly custom action" type does not support targeting both architectures ("Any CPU') of .NET Runtime at once. It can either target the x64 architecture or the x86 one.

Have a look on our "Handle .NET assembly custom action built to target Any CPU architecture of .Net Runtime" I have just posted.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
matthewshorten
Posts: 6
Joined: Wed Jan 17, 2024 3:27 pm

Re: "Call method from .NET assembly" CAs on 32/64 bit platform

Daniel

Thanks for the response and the linked article which makes it clear.

May I suggest an enhancement to AI's "Call method from .Net Assembly" wrapper? It could execute the the registry search you've described, decide for me which .Net runtimes are available and use the appropriate one. That's a simplistic view and I'm sure there'd need to be extra configuration options against the custom action but it would save us installation builders some time.

In the meantime, I'll be implementing the workaround we've discussed.

Regards
Matthew
Daniel
Posts: 8238
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: "Call method from .NET assembly" CAs on 32/64 bit platform

Hi Matthew,

Thank you for your suggestion on this. I have forwarded your request to my dev team and hopefully such improvement will be considered in the future.

When so, we will update this thread.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”