
Parameter to the .net DLL
Posted 16 September 2011 - 10:08
Can anyone suggest me, how to pass parameter to the .net DLL at runtime. My scenario is I have one Dialog in which there are two radio buttons, when user selects either of the radiobutton a .net dll is installed in the system. I want when the Dll is copied into the system, some parameter need to be passed into it. After that installation need to be occur. I am working on basic MSI project.
Thanks
Aditya
Posted 16 September 2011 - 15:30
If you added the action click on it and select your assembly file in the property editor. After that click on "Methodsignature" and select your Method you want to call. Check the Checkbox "Use user-defined methodsignature" and pass your parameters.
This should do the trick
Posted 17 September 2011 - 10:38
Posted 20 September 2011 - 06:32
My problem has been resolved, now I am able to pass parameter. But, in custom action wizard if I select the dll location option as binary table i.e. from the local machine it works fine. However, if I give the option intall from project in which I specify the location of my dll in my project which is Program files, it doesn't work. Please help me.
Thanks
Aditya
Posted 20 September 2011 - 09:58
Stefan Krüger
InstallSite.org twitter facebook
Posted 20 September 2011 - 10:21
As I am new to installshield, I am not sure how to make custom action in sequence. I have created a custom action using custom action wizard, in the wizard I am using location option as "install with the produc"t, In-script execution as "Deferred execution", Install execute sequence as "after installfiles" and install execute condition is equal to some condition.
When I build the project one warning comes which says .netfamework is required. For validation I have used Perform validation using "Installshield validation suite for windows®7, it says dlls you are using must be signed. When I run the installer my installer finished without installing anything on the system.
Thanks
Aditya
Posted 20 September 2011 - 10:46
For vaidation please also use the "full msi" validation suite.
Stefan Krüger
InstallSite.org twitter facebook
Posted 20 September 2011 - 11:39
Thanks for your reply.
I tried what you have suggested, but it doesn't work

Thanks
Aditya
Posted 21 September 2011 - 05:12
Thanks for your reply.
I tried what you have suggested, but it doesn't work sad.gif My dll file will install inside the program files folder. Please let me know if you need more information from my side.
sorry for the typo error in the previous reply.
Thanks
Aditya
Posted 21 September 2011 - 06:07
Just for your information, I have created one dummy .net dll in which I have print the "hello world" when some parameter is pass to it and it is working fine with all the condition like location option as "install with the produc"t, In-script execution as "Deferred execution", Install execute sequence as "after installfiles" and install execute condition is equal to some condition.
Thanks
Aditya
Posted 21 September 2011 - 18:04
Stefan Krüger
InstallSite.org twitter facebook
Posted 22 September 2011 - 05:27
Yes, test Dll also works from Binary table. I did more research on my custom action and found that parameter value which I am passing is not compatible with the data type of my method parameter. However, the same parameter works fine in my previous installer which was build in visual studio. Basically, we have one Installer.vb class in our DLL in which there is a method " Public Overrides Sub Install(ByVal stateSaver As System.Collections.IDictionary)". When I create custom action in visual studio, I use this method and pass the CustomActionData as "/machine="[SCOMVERSIONVALUE]" /mp="A.B.C" /targetdir="[INSTALLDIR]\" it works fine, but the same value doesn't work in installshield, it says it can not convert (system.string into System.Collections.IDictionary).
Thanks
Aditya
Posted 22 September 2011 - 16:49
Stefan Krüger
InstallSite.org twitter facebook
Posted 23 September 2011 - 12:35
Thanks again for your reply.
To resolve this issue I have created one more method in my dll which takes parameter as string and inside that method, I have extracted the key,value pair from the string and store it in a dictionary. After this I called my Install method as Install(dict). Now I am not getting that error, but this time it says:
Loading Assembly Microsoft.EnterpriseManagement.OperationsManager
InstallShield: Couldn't resolve assembly by name Microsoft.EnterpriseManagement.OperationsManager, Version=6.0.4900.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
InstallShield: Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.EnterpriseManagement.OperationsManager, Version=6.0.4900.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
However, I have included these namespaces in my dll, still I am not able to understand why it is throwing such kind of error.
Thanks
Aditya
Posted 26 September 2011 - 14:50
Stefan Krüger
InstallSite.org twitter facebook
Posted 27 September 2011 - 11:09

I was looking for forum for similar kind of problem and I found one forum where similar kind of issue is discussed. In that post they have recommended to first create a setProperty before creating a DeferredAction and to specify some CustomActionData. However, I have tried doing that, I have created a SetProperty after that I have created my DeferredAction but, I am not able to understand how to set those customactiondata and where I need to set those. This is a sample of code they have mentioned in the forum:
#customactions.dll="[#customactions.dll]" name="NativeStorage" connstring="TestConnectionString" filename="{ProgramFilesFolder}\Serveron\SA View\Serveron Client.config" encrypt="true"
Forum Link: http://community.fle...ad.php?p=462313
It would be great if you can give me idea on this.
Thanks
Aditya
Posted 28 September 2011 - 14:27
Stefan Krüger
InstallSite.org twitter facebook