We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

kkkwj
Posts: 88
Joined: Thu Mar 01, 2007 10:45 pm

Syntax for call function from installed DLL

I want to run a C# method (UpgradeDatabase) after installation to merge databases, copy files, and so on. The method lives inside of mycore.dll, which is an installed file. I used the predefined action "Call function from standard DLL" option in the Add Custom Action dialog. The path value = "[#mycore.dll]", which resolves to the correct installed pathname when the installer runs.

But the error message says "Function 'UpgradeDatabase' cannot be found in '<Program files x86/company/product/mycore.dll.'

Using Calling Convention = Standard Calling Convention, I have tried using Classname.UpgradeDatabase and UpgradeDatabase, but both give the same error. I have read all the help documentation (not helpful at all because no syntax discussions or relevant screenshots are shown), searched more than a dozen forum pages with various search strings (not helpful), and looked through all 80 of the videos (not helpful either).

What am I doing wrong? Can you point me to some documentation or working example? Thank you.
kkkwj
Posts: 88
Joined: Thu Mar 01, 2007 10:45 pm

Re: Syntax for call function from installed DLL

This link viewtopic.php?f=1&t=9443&p=26417&hilit= ... dll#p26417 says that only UNMANAGED DLLs can be used by the "Call function from standard DLL." But the link is from many years ago.

Is that still true? Can I use the custom action to call a C# DLL that is part of my installation?
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Syntax for call function from installed DLL

Hello,

I am afraid this is because our "Call function from standard DLL" action type is compatible only with native (unmanaged code) DLLs. To use your .Net DLL as a custom action I recommend you to rewrite it as a DTF C# custom action using the Wix Toolset.

Just follow the steps of our "How to create fully fledged C# custom actions" tutorial and let us know how this works.

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

Return to “Common Problems”