I use this code (defined inside Product node) to launch a simple custom action
<!-- Run as admin -->
<Property Id="Privileged" Value="1" />
<!-- .NET Framework must be 4.6-->
<PropertyRef Id="WIX_IS_NETFRAMEWORK_46_OR_LATER_INSTALLED" />
<Condition Message="You must install Microsoft .NET Framework 4.6 or higher.">
<![CDATA[Installed OR WIX_IS_NETFRAMEWORK_46_OR_LATER_INSTALLED]]>
</Condition>
<Binary Id="Ctav8.CustomAction.CA.dll"
SourceFile="$(var.Ctav8.CustomAction.TargetDir)Ctav8.CustomAction.CA.dll" />
<CustomAction Id="CustomAction1"
Return="check"
Execute="immediate"
BinaryKey="Ctav8.CustomAction.CA.dll"
DllEntry="CustomAction1" />
<InstallExecuteSequence>
<Custom Action="CustomAction1" After="InstallFiles" />
</InstallExecuteSequence>
And this is the simple custom action with its configuration
public class CustomActions
{
[CustomAction]
public static ActionResult CustomAction1(Session session)
{
session.Message(InstallMessage.Warning, new Record
{
FormatString = "test"
});
return ActionResult.Success;
}
}
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v2.0.50727"/>
<supportedRuntime version="v4.0"/>
</startup>
</configuration>
Note: the config file is called 'CustomAction.config' and its Build Action is set to 'Content'. I tried to set 'useLegacyV2RuntimeActivationPolicy' to true and false, but the result is still the same.
If I change the .NET Framework of the custom action project to 3.5, this code works fine.
What's wrong?
Thanks