Hi,

I'm using the C# custome action template in VS to create my first custom 
action, but it failed.

Here is my code:
In Product.wxs
    <Binary Id="CustomActions.dll"  
SourceFile="$(var.CustomActions.TargetDir)$(var.CustomActions.TargetName).CA.dll"
 />
    <CustomAction Id="CustomAction1" BinaryKey="CustomActions.dll"  
DllEntry="CustomAction1" Execute="immediate" />

    <InstallExecuteSequence>
      <Custom Action='CustomAction1' After='InstallFinalize'>NOT 
Installed</Custom>
    </InstallExecuteSequence>

In CustomActions project, CustomAction.cs,
namespace CustomActions
{
    public class CustomActions
    {
        [CustomAction]
        public static ActionResult CustomAction1(Session session)
        {
            session.Log("Begin CustomAction1");
            session.Log(session.GetProductProperty("AGENT_SERVER"));
            return ActionResult.Success;
        }
    }
}

And here is the log:

Action ended 3:50:57: InstallFinalize. Return value 1.
Action 3:50:57: CustomAction1.
Action start 3:50:57: CustomAction1.
SFXCA: Extracting custom action to temporary directory: 
C:\Users\elfexu\AppData\Local\Temp\MSICE39.tmp-\
SFXCA: Binding to CLR version v2.0.50727
Calling custom action CustomActions!CustomActions.CustomActions.CustomAction1
Begin CustomAction1
Exception thrown by custom action:
System.Reflection.TargetInvocationException: Exception has been thrown by the 
target of an invocation. ---> 
Microsoft.Deployment.WindowsInstaller.InvalidHandleException: The handle is 
invalid.
   at Microsoft.Deployment.WindowsInstaller.Session.GetProductProperty(String 
property)
   at CustomActions.CustomActions.CustomAction1(Session session)
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object 
arguments, SignatureStruct& sig, MethodAttributes methodAttributes, 
RuntimeTypeHandle typeOwner)
   at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object 
arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle 
typeOwner)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags 
invokeAttr, Binder binder, Object parameters, CultureInfo culture, Boolean 
skipVisibilityChecks)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags 
invokeAttr, Binder binder, Object parameters, CultureInfo culture)
   at 
Microsoft.Deployment.WindowsInstaller.CustomActionProxy.InvokeCustomAction(Int32
 sessionHandle, String entryPoint, IntPtr remotingDelegatePtr)
CustomAction CustomAction1 returned actual error code 1603 (note this may not 
be 100% accurate if translation happened inside sandbox)
Action ended 3:51:55: CustomAction1. Return value 3.
Action ended 3:51:55: INSTALL. Return value 3.


Any idea about the failure?

Thanks,
-Elfe
------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to