2
votes

I'm using a dll to install a driver that's packaged inside the msi. Following is the snippet:

<Binary Id="CustomAction2.CA.dll"
src="../artifacts/CustomAction2.CA.dll" />

<CustomAction Id="Install"                
        Execute="deferred"
        BinaryKey="CustomAction2.CA.dll" 
        DllEntry="CustomAction1" />

<CustomAction Id="InstallWithProperty"
        Property="Install"
        Value="location=[DEFAULT_INSTALLDIR]$FULL_NAME;name=myDll.dll" Execute="immediate"/>        


<InstallExecuteSequence>      
<Custom Action="InstallWithProperty" After="InstallInitialize"/>
<Custom Action="Install" After="InstallFiles" />
</InstallExecuteSequence>

I am facing same problem. when Custom action is invoked it says.

Exception thrown by custom action: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.DllNotFoundException: Unable to load DLL 'myDll.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E) at CustomAction2.CustomActions.ConfigDriver(IntPtr hwndParent, UInt16 fRequest, String lpszDriver, String lpszArgs, String lpszMsg, UInt16 cbMsgMax, Int64& pcbMsgOut) at CustomAction2.CustomActions.CustomAction1(Session session) --- End of inner exception stack trace --- at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner) at System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType 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 Install returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox)

Can somebody help. I want to use myDll.dll for further installation, which is part of .msi file.

1

1 Answers

0
votes

You are passing mydll.dll which means it'll try to find it in the current directory / temp directory that the DTF CA is running in. Instead pass it the file key of the file. ( File @ Id attribute ).

name=[#myDLL.dll] This will get formatted to something like C:\Program Files\My Company\My Product\myDLL.dll

An alternative is to add the DLL to your CA project so that it gets packaged inside the CA and extracted to the CA current directory at install time.