tslewis
Posts: 65
Joined: Wed Mar 13, 2013 7:06 am

Custom Action - Explaination

What is the benefit of a custom action defined as i) an installed .NET installer class vs ii) a custom action attached to an installation.

What advantages does inheriting the installer class in 1) have over ii) ? I am having issues with i) as I do not want to install the custom action which would require cleaning up afterward and may contain some licensing/security scripts that I don't want to risk people decoding. Hence I'd prefer option ii) but I understand from the help guide that you can use VB.NET

In what situation would you use the different types?
I understand that in the help section that VB.NET cannot be used for type ii) see below for example in C# using WIX incorporation.

http://www.advancedinstaller.com/user-g ... rp-ca.html

HOWEVER, is this true? As I understand WIXnow offers support for VB.NET. Can a type ii) custom action now be defined for VB.NET? See below:

http://www.infoq.com/news/2009/02/WiX30

By supporting managed Custom Actions (CA’s) using Deployment Tools Foundation (DTF) in WiX, developers no longer need to use C++ or scripting (VB Script or JavaScript) to author CA’s. DTF has a managed .NET wrapper on top of the msi.dll giving users access to the complete MSI API. A CA method in C# looks like this:

cheers
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Custom Action - Explaination

Hello,
HOWEVER, is this true? As I understand WIXnow offers support for VB.NET. Can a type ii) custom action now be defined for VB.NET? See below:
You can also create a VB.NET custom action using the DTF framework. In order to achieve this you can use a similar approach as described in our "Create fully fledged C# custom actions" article. For example you can proceed like this:
- Start Visual Studio
- From the Menu bar select “File > New Project”
- From the "New Project" dialog select “WiX” project type and “VB Custom Action Project”
- Develop and build your custom action project.
- Create an Advanced Installer project and add a "Launch attached file" custom action like this:
  • Source Path: Path_to_CustomAction1.CA.dll
    Source Type: Dynamic linked library (*.dll)
    Function: CustomAction1
Also, please note that it is not recommended to use a .Net Installer Class custom action to control the installation behavior. So, if you want to control the installation behavior using a VB.NET custom action it is recommended to use the DTF framework to create a VB.NET custom action.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
tslewis
Posts: 65
Joined: Wed Mar 13, 2013 7:06 am

Re: Custom Action - Explaination

Ok that's good to know. Why aren't custom actions based on the installer class mot recommended?
tslewis
Posts: 65
Joined: Wed Mar 13, 2013 7:06 am

Re: Custom Action - Explaination

Ok, I think I know the answer to this now.

Based on my experience of using javascript, and a custom action based on an installer class. I can see a DTF CA built on VB.NET is wayyyyy easier.

You guys should just flat out state in your help that one should not use anything other than a DTF. I could have saved 2 weeks time if I had just used a DTF. You should also clearly state you can use VB.NET for a DTF, works fine for me.

The latest WIX 3.7 installs and is integrated really well in VS2012.

So far I haven't had any issues with weird syntax errors passing parameters as custom action data to a .NET installer class - see my previous post. That cost me a week right there. Also, I do not have to install the custom action and can attach it to the MSI which would have saved me another week trying to find a way to delete a custom installer class after an install - see my previous posts. You also seem to be able to access both WINDOWS INSTALLER properties and Advanced Installer properties directly from a DTF, not restricted to accessing them from the CustomActionData property. I presume the availability for installer properties accessed directly is limited by the action stage - immediate /deferred etc.
Another nice thing, you can add key value pairs to the CustomActionData property of the session object in a DTF

BUT a DTF CustomActionData uses a ; separator to separate keyvalue pairs not the traditional \ separator defined here:

http://msdn.microsoft.com/en-us/library ... s.80).aspx

example

/execution=Install/name=bob does not work with my DTF

BUT

execution=Install;name=bob DOES work with my DTF

Maybe AI needs an option for this difference when adding a DTF attached to a DLL?

Im using the "Call Function From Attached Native DLL" in the Custom Action option of AI
One issue with AI here, the names of the function defined in my DTF do not automatically pop up, I have to explicitly type them, be nice if AI would resolve this. Using AI 10 and Wix 3.7 with VS2012.

Anyway, glad to finally be making some head way now..............
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Custom Action - Explaination

Hello Steve,

I'm glad you got this working.
Maybe AI needs an option for this difference when adding a DTF attached to a DLL?
Maybe we'll consider this in a future version of Advanced Installer. Thank you for your suggestion.
One issue with AI here, the names of the function defined in my DTF do not automatically pop up, I have to explicitly type them, be nice if AI would resolve this. Using AI 10 and Wix 3.7 with VS2012.
I've tested your scenario and it seems that when use a dll build with DTF its functions are added at the end of the "Function" combo box after a lot of empty new lines. This seems to be an Advanced Installer issue. A fix will be available in a future version of Advanced Installer, thank you for bringing this to our attention. Until then, in order to see the related functions you should scroll down to the bottom of the combo box.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Custom Action - Explaination

Hello,
I've tested your scenario and it seems that when use a dll build with DTF its functions are added at the end of the "Function" combo box after a lot of empty new lines. This seems to be an Advanced Installer issue. A fix will be available in a future version of Advanced Installer, thank you for bringing this to our attention. Until then, in order to see the related functions you should scroll down to the bottom of the combo box.
This was fixed in version 10.2 of Advanced Installer released on May 27, 2013.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
tslewis
Posts: 65
Joined: Wed Mar 13, 2013 7:06 am

Re: Custom Action - Explaination

Brilliant. Great that you follow up with previous customer issues, great product, great support

Return to “Building Installers”