prasadus92
Posts: 58
Joined: Wed Feb 25, 2015 8:10 am

Can we use normal VS custom actions instead of WiX custom actions?

Hi,


Can we use normal custom actions compiled to a DLL using just Visual Studio (Walkthrough: Creating a Custom Action) instead of WiX custom action?

Is there a limitation or problem in doing this?


Thanks in advance.
Prasad
Dan
Posts: 4513
Joined: Wed Apr 24, 2013 3:51 pm

Re: Can we use normal VS custom actions instead of WiX custom actions?

Hi Prasad,

Of course there is no limitation when creating your custom action. For example, you can create your custom action as a a custom action written in C++.

Then you can go in the “Custom Actions” page and add a predefined Call function from attached native DLL custom action. Using this type of custom action you can call a function from a native DLL. Also, the source file will be embedded in the MSI file but will not be deployed at install time with the other application files.

If you have other questions, please let me know.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
prasadus92
Posts: 58
Joined: Wed Feb 25, 2015 8:10 am

Re: Can we use normal VS custom actions instead of WiX custom actions?

Hi Dan,

Thanks for your reply.

Is this the same for C# Custom Actions as well? Because I generated a DLL and then it did not show any of its function name under Advanced Installer custom actions section. Whether I am doing something wrong? Below is my code:

Code: Select all

using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration.Install;
using System.Linq;

namespace InstallerAnalyticsCA
{
    [RunInstaller(true)]
    public partial class Installer1 : System.Configuration.Install.Installer
    {
        public Installer1()
        {
            InitializeComponent();

        }
    }
}
Dan
Posts: 4513
Joined: Wed Apr 24, 2013 3:51 pm

Re: Can we use normal VS custom actions instead of WiX custom actions?

Hi,

This may happens if you didn't export your function from the .dll. In order to export a function from a .DLL, you can take a look on the Exporting from a DLL article with related information for hints and guidance.

However, you can also create your custom action as a DTF C# custom action and you don't have to worry about to export the function from the .DLL as the WiX toolset will help you creating the .dll custom action. Once built your custom action from Visual Studio you can pick up the function to execute using the predefined Call function from attached native DLL.

Should there be any difficulty you encounter implementing something, please do not hesitate to contact me and I will gladly assist.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
chrpai
Posts: 2
Joined: Mon Sep 07, 2015 3:53 pm

Re: Can we use normal VS custom actions instead of WiX custom actions?

It is possible to use Installer class (InstallUtil) custom actions with just about any tool that creates MSIs. I have some detailed notes around here from about 10 years on how to do it. Basically just create a Visual Studio Installer project (.VDPROJ), add a CA and build it. Then examine it in ORCA and take note the native DLL streamed into the binary table (InstallUtilLib.dll or something like that if I recall) , a property that I think gets set and then the custom actions that get authored and scheduled.

But if I may be frank, this is not a best practice. There are many fundamental design problems (CLR binging issues, modal error message boxes during silent installation, out of process unable to access MSI handle, only deferred CA support to name a few) with these custom actions and I highly advise against them. Refactoring your code to use Windows Installer XML's Deployment Tools Foundation (DTF) is a far superior solution and IMO Advanced Installer should be congratulated for welcoming it's use in their product. It's a really good fit.

Return to “Common Problems”